mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
telegram-chat: rework the retry logic
... with increasing delay.
This commit is contained in:
parent
92b4af7b90
commit
1f6040178f
1 changed files with 5 additions and 3 deletions
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue