From d36e580ee7c9990f02c0a4d405194d407fce1323 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Wed, 9 Aug 2017 12:09:44 -0700 Subject: [PATCH] db_purge: fix bugs with assignment deletion - don't delete if --nodelete arg to db_purge - reduce DB queries --- sched/db_purge.cpp | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/sched/db_purge.cpp b/sched/db_purge.cpp index 32ea073883..4bd5254590 100644 --- a/sched/db_purge.cpp +++ b/sched/db_purge.cpp @@ -566,23 +566,15 @@ bool do_pass() { } if (config.enable_assignment) { DB_ASSIGNMENT asg; - sprintf(buf, "where workunitid=%lu", wu.id); - retval = asg.lookup(buf); - if (!retval) { - asg.delete_from_db(); - } + sprintf(buf2, "workunitid=%lu", wu.id); + asg.delete_from_db_multi(buf2); } + } log_messages.printf(MSG_DEBUG, "Purged workunit [%lu] from database\n", wu.id ); - if (config.enable_assignment) { - DB_ASSIGNMENT asg; - sprintf(buf2, "workunitid=%lu", wu.id); - asg.delete_from_db_multi(buf2); - } - purged_workunits++; do_pass_purged_workunits++; wu_stored_in_file++;