diff options
author | Christopher Baines <mail@cbaines.net> | 2022-10-15 08:56:05 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-10-15 08:56:05 +0100 |
commit | 1e1831beca8d44b8d8f35bd466afd62ca3a0b029 (patch) | |
tree | e4a49b53965ababe4dcd223e944c25eb2d2177fe /guix-build-coordinator/agent-messaging/http.scm | |
parent | 8c6e2a6a7c158610da676c49c00d54c7c5d71f1d (diff) | |
download | build-coordinator-1e1831beca8d44b8d8f35bd466afd62ca3a0b029.tar build-coordinator-1e1831beca8d44b8d8f35bd466afd62ca3a0b029.tar.gz |
Throttle calling alarm
Just in case calling it frequently causes problems.
Diffstat (limited to 'guix-build-coordinator/agent-messaging/http.scm')
-rw-r--r-- | guix-build-coordinator/agent-messaging/http.scm | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/guix-build-coordinator/agent-messaging/http.scm b/guix-build-coordinator/agent-messaging/http.scm index b02c598..cec0168 100644 --- a/guix-build-coordinator/agent-messaging/http.scm +++ b/guix-build-coordinator/agent-messaging/http.scm @@ -318,6 +318,12 @@ (if resume? "/partial" "")))) (define (perform-upload) + (define reset-timeout/throttled + (throttle + 120 + (lambda () + (reset-timeout (* 5 60))))) + (let* ((partial-upload-bytes (get-partial-upload-bytes)) (completed-upload-bytes (get-completed-upload-bytes)) (bytes (or partial-upload-bytes @@ -355,7 +361,7 @@ #:method (if bytes 'POST 'PUT) #:report-bytes-sent (lambda args - (reset-timeout (* 5 60)) + (reset-timeout/throttled) (apply report-bytes-sent args))))) (log 'DEBUG "perform upload " file ", response code: " (response-code response)) |