diff --git a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
index 74307683a72915648fdccda08c70d4e01ba02d6a..f505181d4e8f7dcbd4e043084e38b8ab1abbdc48 100644
--- a/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
+++ b/src/plugins/accounting_storage/mysql/accounting_storage_mysql.c
@@ -344,11 +344,11 @@ static bool _check_jobs_before_remove(mysql_conn_t *mysql_conn,
 			(*already_flushed) = 1;
 			reset_mysql_conn(mysql_conn);
 		}
+		if (ret_list)
+			_process_running_jobs_result(cluster_name, result,
+						     ret_list);
 	}
 
-	if (ret_list)
-		_process_running_jobs_result(cluster_name, result, ret_list);
-
 	mysql_free_result(result);
 	return rc;
 }