summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_withdraw.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-03-20 02:36:50 +0100
committerChristian Grothoff <christian@grothoff.org>2020-03-20 02:36:50 +0100
commit10c56bcea05df9ac5a7036850039900fbe435e00 (patch)
tree858b5d691cfecbab0216eaf415ac462e4b07cc37 /src/testing/testing_api_cmd_withdraw.c
parent7a1c6769e428f6f8bb413fb74383c82e16871d2c (diff)
downloadexchange-10c56bcea05df9ac5a7036850039900fbe435e00.tar.gz
exchange-10c56bcea05df9ac5a7036850039900fbe435e00.tar.bz2
exchange-10c56bcea05df9ac5a7036850039900fbe435e00.zip
improving benchmarking logic, including more timings
Diffstat (limited to 'src/testing/testing_api_cmd_withdraw.c')
-rw-r--r--src/testing/testing_api_cmd_withdraw.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/testing/testing_api_cmd_withdraw.c b/src/testing/testing_api_cmd_withdraw.c
index b2fc272e3..1ef341e0a 100644
--- a/src/testing/testing_api_cmd_withdraw.c
+++ b/src/testing/testing_api_cmd_withdraw.c
@@ -40,6 +40,12 @@
* How long do we wait AT LEAST if the exchange says the reserve is unknown?
*/
#define UNKNOWN_MIN_BACKOFF GNUNET_TIME_relative_multiply ( \
+ GNUNET_TIME_UNIT_MILLISECONDS, 10)
+
+/**
+ * How long do we wait AT MOST if the exchange says the reserve is unknown?
+ */
+#define UNKNOWN_MAX_BACKOFF GNUNET_TIME_relative_multiply ( \
GNUNET_TIME_UNIT_MILLISECONDS, 100)
/**
@@ -104,6 +110,11 @@ struct WithdrawState
struct GNUNET_TIME_Relative backoff;
/**
+ * Total withdraw backoff applied.
+ */
+ struct GNUNET_TIME_Relative total_backoff;
+
+ /**
* Expected HTTP response code to the request.
*/
unsigned int expected_response_code;
@@ -193,6 +204,10 @@ reserve_withdraw_cb (void *cls,
else
ws->backoff = GNUNET_TIME_relative_max (UNKNOWN_MIN_BACKOFF,
ws->backoff);
+ ws->backoff = GNUNET_TIME_relative_min (ws->backoff,
+ UNKNOWN_MAX_BACKOFF);
+ ws->total_backoff = GNUNET_TIME_relative_add (ws->total_backoff,
+ ws->backoff);
ws->retry_task = GNUNET_SCHEDULER_add_delayed (ws->backoff,
&do_retry,
ws);
@@ -224,6 +239,14 @@ reserve_withdraw_cb (void *cls,
}
ws->sig.rsa_signature
= GNUNET_CRYPTO_rsa_signature_dup (sig->rsa_signature);
+ if (0 != ws->total_backoff.rel_value_us)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Total withdraw backoff for %s was %s\n",
+ is->commands[is->ip].label,
+ GNUNET_STRINGS_relative_time_to_string (ws->total_backoff,
+ GNUNET_YES));
+ }
break;
case MHD_HTTP_FORBIDDEN:
/* nothing to check */