Skip to content

Commit

Permalink
[Client] Retry getUpdates in 3 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
rojvv committed Apr 12, 2024
1 parent c185664 commit e0019da
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ export class Client<C extends Context = Context> extends Composer<C> {
async start() {
this.#init();
this.#running = true;
const retryIn = 3;
while (this.#running) {
try {
const updates = await this.#request(
Expand All @@ -625,10 +626,10 @@ export class Client<C extends Context = Context> extends Composer<C> {
}
} catch (err) {
console.trace(
"getUpdates request failed, retrying in 10 seconds. Reason:",
`getUpdates request failed, retrying in ${retryIn} seconds. Reason:`,
err,
);
await new Promise((r) => setTimeout(r, 10 * 1_000));
await new Promise((r) => setTimeout(r, retryIn * 1_000));
}
}
}
Expand Down

0 comments on commit e0019da

Please sign in to comment.