From 0f9d68697da12477342cc41825737b282a215f32 Mon Sep 17 00:00:00 2001 From: einhverfr Date: Thu, 20 Dec 2007 00:07:59 +0000 Subject: More contact, payment, voucher fixes/enhancements git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@1984 4979c152-3d1c-0410-bac9-87ea11338e46 --- utils/process_queue/process_queue.pl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'utils/process_queue') diff --git a/utils/process_queue/process_queue.pl b/utils/process_queue/process_queue.pl index 28401eb6..5bcc24ca 100644 --- a/utils/process_queue/process_queue.pl +++ b/utils/process_queue/process_queue.pl @@ -28,19 +28,20 @@ sub on_notify { my $job_id = 1; while ($job_id){ ($job_id) = $dbh->selectrow_array( - "SELECT min(id) from pending_job + "SELECT id from pending_job WHERE completed_at IS NULL + ORDER BY id LIMIT 1 FOR UPDATE" ); if ($job_id){ $job_id = $dbh->quote($job_id); my ($job_class) = $dbh->selectrow_array( "select class from batch_class where id = - (select batch_class from pending_job where id = $job_id" + (select batch_class from pending_job where id = $job_id)" ); # Right now, we assume that every pending job has a batch id. # Longer-run we may need to use a template handle as well. -CT - $dbh->execute('SELECT ' . + $dbh->do('SELECT ' . $dbh->quote_identifier("job__process_$job_class") . "($job_id)" ); my $errstr = $dbh->errstr; @@ -60,6 +61,7 @@ sub on_notify { # The line below is necessary because the job process functions # use set session authorization so one must reconnect to reset # administrative permissions. -CT + $dbh->disconnect; $dbh = db_init(); } } -- cgit v1.2.3