[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-merchant] branch master updated: dynamically adjust long-polling
From: |
gnunet |
Subject: |
[taler-merchant] branch master updated: dynamically adjust long-polling threshold if we get gateway timeouts |
Date: |
Mon, 29 Jan 2024 00:05:52 +0100 |
This is an automated email from the git hooks/post-receive script.
grothoff pushed a commit to branch master
in repository merchant.
The following commit(s) were added to refs/heads/master by this push:
new 39678f88 dynamically adjust long-polling threshold if we get gateway
timeouts
39678f88 is described below
commit 39678f88d5a1270f723a79986bf197a33e7d0424
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Mon Jan 29 00:05:49 2024 +0100
dynamically adjust long-polling threshold if we get gateway timeouts
---
src/backend/taler-merchant-wirewatch.c | 35 ++++++++++++++++++++++++++++++++--
1 file changed, 33 insertions(+), 2 deletions(-)
diff --git a/src/backend/taler-merchant-wirewatch.c
b/src/backend/taler-merchant-wirewatch.c
index 075bdfa4..77428da3 100644
--- a/src/backend/taler-merchant-wirewatch.c
+++ b/src/backend/taler-merchant-wirewatch.c
@@ -34,6 +34,7 @@
#define BANK_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, \
5)
+
/**
* Information about a watch job.
*/
@@ -54,6 +55,11 @@ struct Watch
*/
struct GNUNET_SCHEDULER_Task *task;
+ /**
+ * Dynamically adjusted long polling time-out.
+ */
+ struct GNUNET_TIME_Relative bank_timeout;
+
/**
* For which instance are we importing bank transfers?
*/
@@ -80,6 +86,11 @@ struct Watch
*/
struct GNUNET_TIME_Relative delay;
+ /**
+ * When did we start our last HTTP request?
+ */
+ struct GNUNET_TIME_Absolute start_time;
+
/**
* How long should long-polling take at least?
*/
@@ -415,6 +426,23 @@ credit_cb (
GNUNET_TIME_relative2s (w->delay,
true));
break;
+ case MHD_HTTP_GATEWAY_TIMEOUT:
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Gateway timeout, adjusting long polling threshold\n");
+ /* Limit new timeout at request delay */
+ w->bank_timeout
+ = GNUNET_TIME_relative_min (GNUNET_TIME_absolute_get_duration (
+ w->start_time),
+ w->bank_timeout);
+ /* set the timeout a bit earlier */
+ w->bank_timeout
+ = GNUNET_TIME_relative_subtract (w->bank_timeout,
+ GNUNET_TIME_UNIT_SECONDS);
+ /* do not allow it to go to zero */
+ w->bank_timeout
+ = GNUNET_TIME_relative_max (w->bank_timeout,
+ GNUNET_TIME_UNIT_SECONDS);
+ w->delay = GNUNET_TIME_STD_BACKOFF (w->delay);
default:
/* Something went wrong, try again, but with back-off */
w->delay = GNUNET_TIME_STD_BACKOFF (w->delay);
@@ -449,14 +477,16 @@ do_work (void *cls)
w->task = NULL;
w->found = false;
w->long_poll_timeout
- = GNUNET_TIME_relative_to_absolute (BANK_TIMEOUT);
+ = GNUNET_TIME_relative_to_absolute (w->bank_timeout);
+ w->start_time
+ = GNUNET_TIME_absolute_get ();
w->hh = TALER_MERCHANT_BANK_credit_history (ctx,
&w->ad,
w->start_row,
batch_size,
test_mode
? GNUNET_TIME_UNIT_ZERO
- : BANK_TIMEOUT,
+ : w->bank_timeout,
&credit_cb,
w);
if (NULL == w->hh)
@@ -491,6 +521,7 @@ start_watch (
struct Watch *w = GNUNET_new (struct Watch);
(void) cls;
+ w->bank_timeout = BANK_TIMEOUT;
if (GNUNET_OK !=
TALER_MERCHANT_BANK_auth_parse_json (credit_facade_credentials,
credit_facade_url,
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-merchant] branch master updated: dynamically adjust long-polling threshold if we get gateway timeouts,
gnunet <=