blob: 59da135068d46b7760cf2fd68eda5f601e70d592 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
package FS::Cron::tax_batch;
use FS::TaxEngine;
use FS::queue;
use base qw( Exporter );
@EXPORT_OK = 'process_tax_batch';
sub process_tax_batch {
my %opt = @_;
my $engine = FS::TaxEngine->new;
return unless $engine->info->{batch};
if ( $opt{'m'} ) {
# then there may be queued_bill jobs running; wait for them to finish
while(1) {
my $num_jobs =
FS::queue->count("job = 'FS::cust_main::queued_bill' AND ".
"status != 'failed'");
last if $num_jobs == 0;
warn "Waiting for billing jobs to finish ($num_jobs still active)...\n";
sleep(30);
}
}
$engine->transfer_batch(%opt);
}
1;
|