commit 16a4a09

default  ·  2024-04-22 05:53:40 +0000 UTC
parent cf1c2b1
New server.json knobs "queue_timeout" and "queue_timeout_2".
1 files changed,  +10, -2
+10, -2
 1@@ -2371,6 +2371,7 @@ void process_queue_item(xs_dict *q_item)
 2         int p_status   = xs_number_get(xs_dict_get(q_item, "p_status"));
 3         xs *payload    = NULL;
 4         int p_size     = 0;
 5+        int timeout    = 0;
 6 
 7         if (xs_is_null(inbox) || xs_is_null(msg) || xs_is_null(keyid) || xs_is_null(seckey)) {
 8             srv_log(xs_fmt("output message error: missing fields"));
 9@@ -2383,8 +2384,15 @@ void process_queue_item(xs_dict *q_item)
10         }
11 
12         /* deliver (if previous error status was a timeout, try now longer) */
13-        status = send_to_inbox_raw(keyid, seckey, inbox, msg,
14-                    &payload, &p_size, p_status == 599 ? 8 : 6);
15+        if (p_status == 599)
16+            timeout = xs_number_get(xs_dict_get_def(srv_config, "queue_timeout_2", "8"));
17+        else
18+            timeout = xs_number_get(xs_dict_get_def(srv_config, "queue_timeout", "6"));
19+
20+        if (timeout == 0)
21+            timeout = 6;
22+
23+        status = send_to_inbox_raw(keyid, seckey, inbox, msg, &payload, &p_size, timeout);
24 
25         if (payload) {
26             if (p_size > 64) {