projects
/
freeside.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
586a2e2
)
don't add another queued_bill job to the queue if there's already one waiting to...
author
ivan
<ivan>
Wed, 10 Jun 2009 19:50:01 +0000
(19:50 +0000)
committer
ivan
<ivan>
Wed, 10 Jun 2009 19:50:01 +0000
(19:50 +0000)
FS/FS/Cron/bill.pm
patch
|
blob
|
history
diff --git
a/FS/FS/Cron/bill.pm
b/FS/FS/Cron/bill.pm
index
2b5fab4
..
29f5f36
100644
(file)
--- a/
FS/FS/Cron/bill.pm
+++ b/
FS/FS/Cron/bill.pm
@@
-6,7
+6,8
@@
use Exporter;
use Date::Parse;
use DBI 1.33; #The "clone" method was added in DBI 1.33.
use FS::UID qw(dbh);
use Date::Parse;
use DBI 1.33; #The "clone" method was added in DBI 1.33.
use FS::UID qw(dbh);
-use FS::Record qw(qsearchs);
+use FS::Record qw( qsearch qsearchs );
+use FS::queue;
use FS::cust_main;
use FS::part_event;
use FS::part_event_condition;
use FS::cust_main;
use FS::part_event;
use FS::part_event_condition;
@@
-141,6
+142,14
@@
END
if ( $opt{'r'} ) {
warn "DRY RUN: would add custnum $custnum for queued_bill\n";
} else {
if ( $opt{'r'} ) {
warn "DRY RUN: would add custnum $custnum for queued_bill\n";
} else {
+
+ #avoid queuing another job if there's one still waiting to run
+ next if qsearch( 'queue', { 'job' => 'FS::cust_main::queued_bill',
+ 'custnum' => $custnum,
+ 'status' => 'new',
+ }
+ );
+
#add job to queue that calls bill_and_collect with options
my $queue = new FS::queue {
'job' => 'FS::cust_main::queued_bill',
#add job to queue that calls bill_and_collect with options
my $queue = new FS::queue {
'job' => 'FS::cust_main::queued_bill',
@@
-148,6
+157,7
@@
END
'priority' => 99, #don't get in the way of provisioning jobs
};
my $error = $queue->insert( 'custnum'=>$custnum, %args );
'priority' => 99, #don't get in the way of provisioning jobs
};
my $error = $queue->insert( 'custnum'=>$custnum, %args );
+
}
} else {
}
} else {