]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: acme: allow a delay after a valid response
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 2 May 2025 08:16:12 +0000 (10:16 +0200)
committerWilliam Lallemand <wlallemand@haproxy.com>
Fri, 2 May 2025 08:16:12 +0000 (10:16 +0200)
Use the retryafter value to set a delay before doing the next request
when the previous response was valid.

src/acme.c

index 139d2ad3457a04730ce4f2cbfc0233e2a5050809..87efad7ed1f34b4f11861abaf04d97d949be1eb9 100644 (file)
@@ -1936,7 +1936,18 @@ nextreq:
        /* this is called when changing step in the state machine */
        http_st = ACME_HTTP_REQ;
        ctx->retries = ACME_RETRY; /* reinit the retries */
-       goto re; /* optimize by not leaving the task for the next httpreq to init */
+
+       if (ctx->retryafter == 0)
+               goto re; /* optimize by not leaving the task for the next httpreq to init */
+
+       /* if we have a retryafter, wait before next request (usually finalize) */
+       task->expire = tick_add(now_ms, ctx->retryafter * 1000);
+       ctx->retryafter = 0;
+       ctx->http_state = http_st;
+       ctx->state = st;
+
+       MT_LIST_UNLOCK_FULL(&ctx->el, tmp);
+       return task;
 
 retry:
        ctx->http_state = ACME_HTTP_REQ;