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: Wrap asgi application to ignore lifetime requests #21858

Merged
merged 3 commits into from
Apr 26, 2024

Conversation

frankh
Copy link
Contributor

@frankh frankh commented Apr 25, 2024

Problem

second attempt of #21802

ASGI servers send "lifetime" requests to django at startup and shutdown.

The ASGI spec allows these to fail, in which case the server ignores them, however the way django fails them sends an exception to sentry which we don't want.

Overwrite the handler to return a 501 error without throwing an exception

Changes

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

@frankh frankh force-pushed the frank/ignore-lifetime-requests branch from 4bdaa5d to 41c9ba6 Compare April 25, 2024 15:48
@frankh frankh requested review from benjackwhite and Twixes April 25, 2024 15:48
ASGI servers send "lifetime" requests to django at startup and shutdown.

The ASGI spec allows these to fail, in which case the server ignores them, however
the way django fails them sends an exception to sentry which we don't want.

Overwrite the handler to return a 501 error without throwing an exception
@frankh frankh force-pushed the frank/ignore-lifetime-requests branch from 41c9ba6 to 4c914e3 Compare April 25, 2024 15:52
@frankh frankh added the canary label Apr 26, 2024
@frankh frankh merged commit 0390122 into master Apr 26, 2024
97 of 99 checks passed
@frankh frankh deleted the frank/ignore-lifetime-requests branch April 26, 2024 07:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants