From f76e7c46e6609d39d5b28cb489a946833ca58bfb Mon Sep 17 00:00:00 2001 From: Christian Grothoff Date: Thu, 19 Mar 2020 19:33:20 +0100 Subject: make do_retry not retry forever in tests/benchmark --- src/testing/testing_api_cmd_bank_admin_add_incoming.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/testing/testing_api_cmd_bank_admin_add_incoming.c') diff --git a/src/testing/testing_api_cmd_bank_admin_add_incoming.c b/src/testing/testing_api_cmd_bank_admin_add_incoming.c index 2398c5be3..6e707a2e4 100644 --- a/src/testing/testing_api_cmd_bank_admin_add_incoming.c +++ b/src/testing/testing_api_cmd_bank_admin_add_incoming.c @@ -32,6 +32,12 @@ #include "taler_testing_lib.h" +/** + * How often do we retry before giving up? + */ +#define NUM_RETRIES 5 + + /** * State for a "fakebank transfer" CMD. */ @@ -120,9 +126,9 @@ struct AdminAddIncomingState /** * Was this command modified via * #TALER_TESTING_cmd_admin_add_incoming_with_retry to - * enable retries? + * enable retries? If so, how often should we still retry? */ - int do_retry; + unsigned int do_retry; }; @@ -184,8 +190,9 @@ confirmation_cb (void *cls, fts->aih = NULL; if (MHD_HTTP_OK != http_status) { - if (GNUNET_YES == fts->do_retry) + if (0 != fts->do_retry) { + fts->do_retry--; if ( (0 == http_status) || (TALER_EC_DB_COMMIT_FAILED_ON_RETRY == ec) || (MHD_HTTP_INTERNAL_SERVER_ERROR == http_status) ) @@ -588,7 +595,7 @@ TALER_TESTING_cmd_admin_add_incoming_retry (struct TALER_TESTING_Command cmd) GNUNET_assert (&admin_add_incoming_run == cmd.run); fts = cmd.cls; - fts->do_retry = GNUNET_YES; + fts->do_retry = NUM_RETRIES; return cmd; } -- cgit v1.2.3