grammyjs / auto-retry

A transformer function for retrying requests.
https://grammy.dev/plugins/auto-retry
MIT License
7 stars 2 forks source link

Conflict with the `runner` plugin in a NestJS app #18

Closed andrew-sol closed 2 months ago

andrew-sol commented 2 months ago

When this plugin is used in a NestJS app, the following promise will never resolve:

await this.runnerHandle.stop(); // hangs forever, though the bot stops fetching updates

Because of this the app never recompiles when you change the code.

Removing the following line makes the app behave normally:

this.bot.api.config.use(autoRetry());

See the reproduction repo: https://github.com/andrew-sol/grammy-runner-reproduction (app.service.ts file) The repo has two branches: main and without-nest.

The bug is reproducible only on the main branch. The without-nest branch contains the same setup but without the NestJS framework and TypeScript.

Related: https://github.com/grammyjs/runner/issues/22

KnorpelSenf commented 2 months ago

Thanks for the short repro, that made it easy to reproduce the issue. The auto-retry plugin did handle signals correctly while waiting between retries, but it incorrectly did not rethrow errors when actual requests were aborted.

19 fixes that. Could you leave a review?