Hi all. Doing some tests for the last couple of weeks, one of the
things I have noticed is the one Juan Fernández noticed some time ago,
and wrote about here in the dev list:

http://www.mail-archive.com/[email protected]/msg04895.html

which is that if a number of requests that had been queued in
smsbox_http_requests, each time the thread is awaken it only start the
processing of one the pending requests. I believe it would be best if
a number of requests would be processed each time, so I've added a new
configuration directive for the smsbox group, bulk-retry-q.

diff -ub -r original/gateway/gw/smsbox.c bulk/gateway/gw/smsbox.c
--- original/gateway/gw/smsbox.c        Mon Sep 19 19:07:32 2005
+++ bulk/gateway/gw/smsbox.c    Wed Oct 19 16:37:35 2005
@@ -91,6 +91,7 @@
 /* Defaults for the HTTP request queueing inside http_queue_thread */
 #define HTTP_MAX_RETRIES    0
 #define HTTP_RETRY_DELAY    10 /* in sec. */
+#define BULK_RETRY_Q        10 /* How many should we move to incoming */

 /* have we received restart cmd from bearerbox? */
 volatile sig_atomic_t restart = 0;
@@ -139,6 +140,8 @@
 static Dict *client_dict = NULL;
 static List *sendsms_reply_hdrs = NULL;

+static long bulk_retry_q = BULK_RETRY_Q;
+
 /***********************************************************************
  * Communication with the bearerbox.
  */
@@ -1040,6 +1043,7 @@
     Octstr *req_body;
     unsigned long retries;
     int method;
+    long bulk_i;

     while ((id = gwlist_consume(smsbox_http_requests)) != NULL) {
         /*
@@ -1053,6 +1057,8 @@
         debug("sms.http",0,"HTTP: Queue contains %ld outstanding requests",
               gwlist_len(smsbox_http_requests));

+       bulk_i = 0;
+       do{
         /*
          * Get all required HTTP request data from the queue and reconstruct
          * the id pointer for later lookup in url_result_thread.
@@ -1074,6 +1080,7 @@
         octstr_destroy(req_url);
         http_destroy_headers(req_headers);
         octstr_destroy(req_body);
+       }while((++bulk_i < bulk_retry_q) && ((id =
gwlist_consume(smsbox_http_requests)) != NULL));
     }
 }

@@ -3270,6 +3277,7 @@
     Octstr *http_proxy_exceptions_regex = NULL;
     int ssl = 0;
     int lf, m;
+    long bulk_q;

     bb_port = BB_DEFAULT_SMSBOX_PORT;
     bb_ssl = 0;
@@ -3291,6 +3299,9 @@
     cfg_get_bool(&bb_ssl, grp, octstr_imm("smsbox-port-ssl"));
 #endif /* HAVE_LIBSSL */

+    cfg_get_integer(&bulk_q, grp, octstr_imm("bulk-retry-q"));
+    if((bulk_q > 0))
+       bulk_retry_q = bulk_q;
     cfg_get_integer(&http_proxy_port, grp, octstr_imm("http-proxy-port"));

     http_proxy_host = cfg_get(grp,
diff -ub -r original/gateway/gwlib/cfg.def bulk/gateway/gwlib/cfg.def
--- original/gateway/gwlib/cfg.def      Tue Sep 20 23:01:22 2005
+++ bulk/gateway/gwlib/cfg.def  Wed Oct 19 16:37:58 2005
@@ -268,6 +268,7 @@
     OCTSTR(white-list-regex)
     OCTSTR(black-list-regex)
     OCTSTR(immediate-sendsms-reply)
+    OCTSTR(bulk-retry-q)
 )

Cheers!
--
Juan
PS: Right subject this time, I'm sorry. Previous mail should have had
a different one.

Reply via email to