diff options
author | Christian Hesse <mail@eworm.de> | 2023-10-19 21:13:04 +0200 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2023-10-19 21:13:04 +0200 |
commit | 1f6040178fa14fafb1561c97a7f5aff9449c1ba6 (patch) | |
tree | b2bcaab1b9a80033036ebcdb239185c17ec34c89 | |
parent | 92b4af7b90d291466433fbb0173e8b93e6459655 (diff) |
telegram-chat: rework the retry logic
... with increasing delay.
-rw-r--r-- | telegram-chat.rsc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/telegram-chat.rsc b/telegram-chat.rsc index e0a6295..686becc 100644 --- a/telegram-chat.rsc +++ b/telegram-chat.rsc @@ -48,15 +48,17 @@ $WaitFullyConnected; } :local Data false; -:for I from=2 to=0 do={ +:for I from=1 to=4 do={ :if ($Data = false) do={ :do { :set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \ ("https://api.telegram.org/bot" . $TelegramTokenId . "/getUpdates?offset=" . \ $TelegramChatOffset->0 . "&allowed_updates=%5B%22message%22%5D") as-value ]->"data"); } on-error={ - $LogPrintExit2 debug $0 ("Fetch failed, " . $I . " retries pending.") false; - :delay 2s; + :if ($I < 4) do={ + $LogPrintExit2 debug $0 ("Fetch failed, " . $I . ". try.") false; + :delay (($I * $I) "s"); + } } } } |