From: jeff Date: Mon, 28 Aug 2006 00:52:44 +0000 (+0000) Subject: protect against a race X-Git-Tag: TRIXBOX_2_6~999 X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=commitdiff_plain;h=f43c7c5765db18b35a3d3bec837681725bf0c245 protect against a race --- diff --git a/FS/FS/cust_bill.pm b/FS/FS/cust_bill.pm index 1801b125f..e1281e372 100644 --- a/FS/FS/cust_bill.pm +++ b/FS/FS/cust_bill.pm @@ -1327,6 +1327,9 @@ sub batch_card { local $FS::UID::AutoCommit = 0; my $dbh = dbh; + $dbh->do("LOCK TABLE pay_batch IN SHARE ROW EXCLUSIVE MODE") + or return "Cannot lock pay_batch: " . $dbh->errstr; + my $pay_batch = qsearchs('pay_batch', {'status' => 'O'}); unless ( $pay_batch ) {