Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: stop the aiohttp app when the metricq HistoryClient is stopped and vice versa #40

Merged
merged 1 commit into from
Sep 27, 2021

Conversation

tilsche
Copy link
Contributor

@tilsche tilsche commented Sep 25, 2021

We setup a watchdog that (a)waits for the HistoryClient to stop for whatever reason and then emulates the aiohttp signal handler.
If the app is stopped first, this watchdog is cancelled so that we don't get some kind of recursive mess.
Also, the on the app cleanup (caused by the signal handler), we properly stop the HistoryClient.
This does not deal with any open client connection tasks that may or may not need some extra cancellation.

This makes #39 obsolete.

The "Graceful" way to stop applications ran by aiohttp seems pretty broken and undocumented (aio-libs/aiohttp#2950). This works, but hopefully some day there will be a better way without having to implement half of aiohttp.

@tilsche tilsche requested a review from bmario September 25, 2021 12:01
…nd vice versa

We setup a watchdog that (a)waits for the HistoryClient to stop for whatever reason and then emulates the aiohttp signal handler.
If the app is stopped first, this watchdog is cancelled so that we don't get some kind of recursive mess.
Also, the on the app cleanup (caused by the signal handler), we properly stop the HistoryClient.
This does not deal with any open client connection tasks that may or may not need some extra cancellation.
@tilsche tilsche force-pushed the aiohttp-metricq-stop-each-other branch from 06a7f46 to 7653c02 Compare September 25, 2021 12:07
@tilsche tilsche self-assigned this Sep 27, 2021
@bmario bmario merged commit 71225d1 into master Sep 27, 2021
@bmario bmario deleted the aiohttp-metricq-stop-each-other branch September 27, 2021 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants