PR#3977: handle new task refs in clean_scratch_tasks
Merges #3977 https://pagure.io/koji/pull-request/3977 Fixes: #3978 https://pagure.io/koji/issue/3978 koji-sweep-db fails on scratch builds
This commit is contained in:
commit
8898c6e8db
1 changed files with 11 additions and 4 deletions
|
|
@ -111,10 +111,17 @@ def clean_scratch_tasks(cursor, vacuum, test, age):
|
|||
if not ids:
|
||||
return
|
||||
|
||||
# delete standard buildroots
|
||||
delete = DeleteProcessor(table='standard_buildroot',
|
||||
clauses=['task_id IN (SELECT task_id FROM temp_scratch_tasks)'])
|
||||
delete.execute()
|
||||
# delete from referring tables
|
||||
ref_tables = (
|
||||
'standard_buildroot',
|
||||
'scheduler_task_runs',
|
||||
'scheduler_task_refusals',
|
||||
'scheduler_log_messages',
|
||||
)
|
||||
for table in ref_tables:
|
||||
delete = DeleteProcessor(table=table,
|
||||
clauses=['task_id IN (SELECT task_id FROM temp_scratch_tasks)'])
|
||||
delete.execute()
|
||||
|
||||
# delete tasks finally
|
||||
delete = DeleteProcessor(table='task',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue