Add the logentrykind and performer information to log listing. This makes the system much faster, since new queries are not needed for every log entry.
This commit is contained in:
parent
9b31b9805a
commit
cc7bccea4c
1 changed files with 9 additions and 1 deletions
|
@ -2046,7 +2046,15 @@ def list_repo_notifications(namespace_name, repository_name, event_name=None):
|
|||
|
||||
|
||||
def list_logs(start_time, end_time, performer=None, repository=None, namespace=None):
|
||||
joined = LogEntry.select().join(User)
|
||||
Performer = User.alias()
|
||||
joined = (LogEntry.select(LogEntry, LogEntryKind, User, Performer)
|
||||
.join(User)
|
||||
.switch(LogEntry)
|
||||
.join(Performer, JOIN_LEFT_OUTER,
|
||||
on=(LogEntry.performer == Performer.id).alias('performer'))
|
||||
.switch(LogEntry)
|
||||
.join(LogEntryKind))
|
||||
|
||||
if repository:
|
||||
joined = joined.where(LogEntry.repository == repository)
|
||||
|
||||
|
|
Reference in a new issue