diff options
| author | 2025-10-12 15:13:05 +0300 | |
|---|---|---|
| committer | 2025-10-12 15:13:05 +0300 | |
| commit | bb548b45889e55eb4aa8508e379c2a3d4badb7b5 (patch) | |
| tree | 7086117a345c0a27a70232c9232831abfd5dd720 /src/bot/impl.lisp | |
| parent | Bunch of changes (diff) | |
| download | ukkoclot-bb548b45889e55eb4aa8508e379c2a3d4badb7b5.tar.gz ukkoclot-bb548b45889e55eb4aa8508e379c2a3d4badb7b5.tar.xz ukkoclot-bb548b45889e55eb4aa8508e379c2a3d4badb7b5.zip | |
Try to work around broken connections
Diffstat (limited to 'src/bot/impl.lisp')
| -rw-r--r-- | src/bot/impl.lisp | 9 |
1 files changed, 6 insertions, 3 deletions
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 @@ | |||
| 3 | (defpackage :ukkoclot/bot/impl | 3 | (defpackage :ukkoclot/bot/impl |
| 4 | (:use :c2cl :iterate :ukkoclot/config :ukkoclot/log) | 4 | (:use :c2cl :iterate :ukkoclot/config :ukkoclot/log) |
| 5 | (:import-from :anaphora :aand :acond :it) | 5 | (:import-from :anaphora :aand :acond :it) |
| 6 | (:import-from :cl+ssl) | ||
| 6 | (:import-from :dex) | 7 | (:import-from :dex) |
| 7 | (:import-from :ukkoclot/strings :lisp->snake-case) | 8 | (:import-from :ukkoclot/strings :lisp->snake-case) |
| 8 | (:local-nicknames | 9 | (:local-nicknames |
| @@ -86,9 +87,11 @@ | |||
| 86 | (fixup-value value))))) | 87 | (fixup-value value))))) |
| 87 | 88 | ||
| 88 | (defun req (uri method content) | 89 | (defun req (uri method content) |
| 89 | ;; We deal with this manually | 90 | (let ((retrier (dex:retry-request 5 :interval 1))) |
| 90 | (handler-bind ((dex:http-request-too-many-requests #'dex:ignore-and-continue)) | 91 | (handler-case (dex:request uri :method method :content content) |
| 91 | (dex:request uri :method method :content content))) | 92 | (dex:http-request-too-many-requests (e) (dex:ignore-and-continue e)) ; We deal with too many reqs manually |
| 93 | (dex:http-request-failed (e) (funcall retrier e)) | ||
| 94 | (cl+ssl::ssl-error (e) (funcall retrier e))))) | ||
| 92 | 95 | ||
| 93 | (defun do-call% (bot method uri type args-encoded) | 96 | (defun do-call% (bot method uri type args-encoded) |
| 94 | (let ((body (req uri method args-encoded))) | 97 | (let ((body (req uri method args-encoded))) |