From: William Lallemand Date: Fri, 11 Apr 2025 22:47:33 +0000 (+0200) Subject: MINOR: acme: schedule retries with a timer X-Git-Tag: v3.2-dev11~80 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a96cbe32b6d301c26f23bccdd9d150c2dc6d0dcb;p=thirdparty%2Fhaproxy.git MINOR: acme: schedule retries with a timer Schedule the retries with a 3s exponential timer. This is a temporary mesure as the client should follow the Retry-After field for rate-limiting for every request (https://datatracker.ietf.org/doc/html/rfc8555#section-6.6) --- diff --git a/src/acme.c b/src/acme.c index df4b199cb..0c80fcf76 100644 --- a/src/acme.c +++ b/src/acme.c @@ -1659,7 +1659,7 @@ struct task *acme_process(struct task *task, void *context, unsigned int state) ctx->http_state = http_st; ctx->state = st; - + task->expire = TICK_ETERNITY; return task; retry: @@ -1668,8 +1668,14 @@ retry: ctx->retries--; if (ctx->retries > 0) { - ha_notice("acme: %s, retrying (%d/%d)...\n", errmsg ? errmsg : "", ACME_RETRY-ctx->retries, ACME_RETRY); - task_wakeup(task, TASK_WOKEN_MSG); + int delay = 1; + int i; + + for (i = 0; i < ACME_RETRY - ctx->retries; i++) + delay *= 3000; + ha_notice("acme: %s, retrying in %dms (%d/%d)...\n", errmsg ? errmsg : "", delay, ACME_RETRY-ctx->retries, ACME_RETRY); + task->expire = tick_add(now_ms, delay); + } else { ha_notice("acme: %s, aborting. (%d/%d)\n", errmsg ? errmsg : "", ACME_RETRY-ctx->retries, ACME_RETRY); goto end;