From bb548b45889e55eb4aa8508e379c2a3d4badb7b5 Mon Sep 17 00:00:00 2001 From: Uko Kokņevičs Date: Sun, 12 Oct 2025 15:13:05 +0300 Subject: Try to work around broken connections --- src/bot/impl.lisp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/bot/impl.lisp b/src/bot/impl.lisp index 57a9572..162938e 100644 --- a/src/bot/impl.lisp +++ b/src/bot/impl.lisp @@ -3,6 +3,7 @@ (defpackage :ukkoclot/bot/impl (:use :c2cl :iterate :ukkoclot/config :ukkoclot/log) (:import-from :anaphora :aand :acond :it) + (:import-from :cl+ssl) (:import-from :dex) (:import-from :ukkoclot/strings :lisp->snake-case) (:local-nicknames @@ -86,9 +87,11 @@ (fixup-value value))))) (defun req (uri method content) - ;; We deal with this manually - (handler-bind ((dex:http-request-too-many-requests #'dex:ignore-and-continue)) - (dex:request uri :method method :content content))) + (let ((retrier (dex:retry-request 5 :interval 1))) + (handler-case (dex:request uri :method method :content content) + (dex:http-request-too-many-requests (e) (dex:ignore-and-continue e)) ; We deal with too many reqs manually + (dex:http-request-failed (e) (funcall retrier e)) + (cl+ssl::ssl-error (e) (funcall retrier e))))) (defun do-call% (bot method uri type args-encoded) (let ((body (req uri method args-encoded))) -- cgit v1.2.3