Merge pull request #5694 from bema-aei/fix_db_purge

sched/db_purge: if a result fails to be deleted, don't purge the referencing workunit
This commit is contained in:
Vitalii Koshura 2024-07-18 11:41:53 +02:00 committed by GitHub
commit f2be5afc70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 1 deletions

View File

@ -588,7 +588,12 @@ int purge_and_archive_results(DB_WORKUNIT& wu, int& number_results) {
);
} else {
retval = result.delete_from_db();
if (retval) return retval;
if (retval) {
log_messages.printf(MSG_CRITICAL,
"Couldn't delete result [%d] from database\n", result.id
);
return retval;
}
log_messages.printf(MSG_DEBUG,
"Purged result [%lu] from database\n", result.id
);
@ -675,6 +680,10 @@ bool do_pass() {
}
retval = purge_and_archive_results(wu, n);
// if a result fails to be deleted, don't purge this workunit,
// or this result will be left orphaned and never get deleted
if (retval) continue;
do_pass_purged_results += n;
if (!no_archive) {