@worca/ui 0.9.0-rc.7 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -112,12 +112,15 @@ export function createTelegramAdapter({
|
|
|
112
112
|
|
|
113
113
|
async function pollLoop() {
|
|
114
114
|
let cursor = await readCursor(cursorPath);
|
|
115
|
+
let firstPoll = true;
|
|
115
116
|
while (running) {
|
|
116
117
|
try {
|
|
118
|
+
const pollTimeout = firstPoll ? 0 : LONG_POLL_TIMEOUT_SEC;
|
|
117
119
|
const url =
|
|
118
120
|
`${TELEGRAM_API}/bot${token}/getUpdates` +
|
|
119
|
-
`?offset=${cursor}&timeout=${
|
|
121
|
+
`?offset=${cursor}&timeout=${pollTimeout}`;
|
|
120
122
|
const res = await fetchFn(url);
|
|
123
|
+
firstPoll = false;
|
|
121
124
|
if (res.status === 429) {
|
|
122
125
|
const data = await res.json().catch(() => ({}));
|
|
123
126
|
const ms = (data.parameters?.retry_after ?? 1) * 1000;
|