mirror of
https://github.com/eworm-de/routeros-scripts
synced 2024-05-14 08:04:19 +00:00
telegram-chat: retry on fetch failure...
... and exit with a warning.
This commit is contained in:
parent
ab44377fb6
commit
fffe0a3b50
|
@ -47,13 +47,22 @@ $WaitFullyConnected;
|
||||||
$LogPrintExit2 warning $0 ("Downloading required certificate failed.") true;
|
$LogPrintExit2 warning $0 ("Downloading required certificate failed.") true;
|
||||||
}
|
}
|
||||||
|
|
||||||
:local Data;
|
:local Data false;
|
||||||
:do {
|
:for I from=2 to=0 do={
|
||||||
:set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \
|
:if ($Data = false) do={
|
||||||
("https://api.telegram.org/bot" . $TelegramTokenId . "/getUpdates?offset=" . \
|
:do {
|
||||||
$TelegramChatOffset->0 . "&allowed_updates=%5B%22message%22%5D") as-value ]->"data");
|
:set Data ([ /tool/fetch check-certificate=yes-without-crl output=user \
|
||||||
} on-error={
|
("https://api.telegram.org/bot" . $TelegramTokenId . "/getUpdates?offset=" . \
|
||||||
$LogPrintExit2 debug $0 ("Failed getting updates from Telegram.") true;
|
$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 ($Data = false) do={
|
||||||
|
$LogPrintExit2 warning $0 ("Failed getting updates from Telegram.") true;
|
||||||
}
|
}
|
||||||
|
|
||||||
:local UpdateID 0;
|
:local UpdateID 0;
|
||||||
|
|
Loading…
Reference in a new issue