grammyjs / runner

Scale bots that use long polling to receive updates.
https://grammy.dev/plugins/runner
MIT License
19 stars 3 forks source link

Abort `getUpdates` when stopping runner #20

Closed evermake closed 7 months ago

evermake commented 11 months ago

When .stop()ing runner it doesn't abort getUpdates API call. As a result, it hangs until long polling interval passes (e.g. up to 30 seconds) even if there are no updates to process.

This delay is annoying while developing and also when running a bot in Docker. Not sure it's a good idea to shutdown a bot using SIGKILL each time.

KnorpelSenf commented 11 months ago

The runner is supposed to terminate pending calls: https://github.com/grammyjs/runner/blob/b1da579c981e1070508d6c7c352ebe7d3a886b98/src/source.ts#L181 is called by https://github.com/grammyjs/runner/blob/b1da579c981e1070508d6c7c352ebe7d3a886b98/src/runner.ts#L330 but if you observe a different behaviour, then there is a bug somewhere. Could you provide a minmal repro?

evermake commented 7 months ago

Sorry, seems like it's not related to grammY but to bun.

KnorpelSenf commented 7 months ago

Holy crap, is this another case where it executes JS incorrectly?

evermake commented 7 months ago

Seems like that. As far as I understand, the problem was with workers and/or signals controller.