summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authoreinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-12-20 00:07:59 +0000
committereinhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46>2007-12-20 00:07:59 +0000
commit0f9d68697da12477342cc41825737b282a215f32 (patch)
tree4c2eea402e7e3a0800c5fc29a0ed1a65800ac14c /utils
parentde4c93c23b93218ec5feaec2ebb01189f73428a2 (diff)
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
Diffstat (limited to 'utils')
-rw-r--r--utils/process_queue/process_queue.pl8
1 files changed, 5 insertions, 3 deletions
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();
}
}