add queued-sleep_time
authorivan <ivan>
Tue, 29 Dec 2009 00:38:07 +0000 (00:38 +0000)
committerivan <ivan>
Tue, 29 Dec 2009 00:38:07 +0000 (00:38 +0000)
FS/FS/Conf.pm
FS/bin/freeside-queued

index 47555a3..eb3238a 100644 (file)
@@ -690,7 +690,7 @@ worry that config_items is freeside-specific and icky.
   {
     'key'         => 'business-onlinepayment-description',
     'section'     => 'billing',
   {
     'key'         => 'business-onlinepayment-description',
     'section'     => 'billing',
-    'description' => 'String passed as the description field to <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a>.  Evaluated as a double-quoted perl string, with the following variables available: <code>$agent</code> (the agent name), and <code>$pkgs</code> (a comma-separated list of packages for which these charges apply)',
+    'description' => 'String passed as the description field to <a href="http://search.cpan.org/search?mode=module&query=Business%3A%3AOnlinePayment">Business::OnlinePayment</a>.  Evaluated as a double-quoted perl string, with the following variables available: <code>$agent</code> (the agent name), and <code>$pkgs</code> (a comma-separated list of packages for which these charges apply - not available in all situations)',
     'type'        => 'text',
   },
 
     'type'        => 'text',
   },
 
@@ -3168,6 +3168,13 @@ worry that config_items is freeside-specific and icky.
   },
 
   {
   },
 
   {
+    'key'         => 'queued-sleep_time',
+    'section'     => '',
+    'description' => 'Time to sleep between attempts to find new jobs to process in the queue.  Defaults to 10.  Installations doing real-time CDR processing for prepaid may want to set it lower.'
+    'type'        => 'text',
+  },
+
+  {
     'key'         => 'cancelled_cust-noevents',
     'section'     => 'billing',
     'description' => "Don't run events for cancelled customers",
     'key'         => 'cancelled_cust-noevents',
     'section'     => 'billing',
     'description' => "Don't run events for cancelled customers",
index d5d84cc..ffd017a 100644 (file)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
 #!/usr/bin/perl -w
 
 use strict;
-use vars qw( $DEBUG $kids $max_kids %kids );
+use vars qw( $DEBUG $kids $max_kids $sleep_time %kids );
 use POSIX qw(:sys_wait_h);
 use IO::File;
 use Getopt::Std;
 use POSIX qw(:sys_wait_h);
 use IO::File;
 use Getopt::Std;
@@ -54,6 +54,7 @@ daemonize2();
 
 my $conf = new FS::Conf;
 $max_kids = $conf->config('queued-max_kids') || 10;
 
 my $conf = new FS::Conf;
 $max_kids = $conf->config('queued-max_kids') || 10;
+$sleep_time = $conf->config('queued-sleep_time') || 10;
 
 my $warnkids=0;
 while (1) {
 
 my $warnkids=0;
 while (1) {
@@ -128,7 +129,7 @@ while (1) {
       undef $FS::UID::dbh;
       next;
     };
       undef $FS::UID::dbh;
       next;
     };
-    sleep 1;
+    sleep $sleep_time;
     next;
   }
 
     next;
   }