misc: iterate AfterJob one by one when cleaning them (#56191)

This commit is contained in:
Benjamin Dauvergne 2021-08-16 16:56:59 +02:00
parent 1aea2407ce
commit 16a91507d4
1 changed files with 2 additions and 1 deletions

View File

@ -637,7 +637,8 @@ class QommonPublisher(Publisher):
def clean_afterjobs(self):
now = time.time()
for job in AfterJob.select():
for job_id in AfterJob.keys():
job = AfterJob.get(job_id)
if job.status == 'completed' and (now - job.completion_time) > 3600:
# completed for more than one hour
job.remove_self()