Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Ensure background task cancellation in startup_event #425

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

Draft
seer-by-sentry wants to merge 2 commits into main
base: main
Choose a base branch
Loading
from seer/ensure-background-task-cancellation

Conversation

Copy link

@seer-by-sentry seer-by-sentry bot commented Jul 17, 2025

Fixes GITINGEST-2. The issue was that: Uvicorn cancels ASGI receive() during shutdown; Starlette's lifespan handler does not catch CancelledError.

  • Modified the startup_event function to use a try...finally block to ensure that the background task _remove_old_repositories is always cancelled, even if an exception occurs during the application's startup.

This fix was generated by Seer in Sentry, triggered by Mickael. 👁️ Run ID: 15919

Not quite right? Click here to continue debugging with Seer.

@MickaelCa MickaelCa force-pushed the seer/ensure-background-task-cancellation branch from 40f3cc9 to f06a6b5 Compare July 17, 2025 11:39
Copy link

github-actions bot commented Jul 17, 2025
edited
Loading

⚙️ Preview environment was undeployed.

@MickaelCa MickaelCa added push-container Allow the PR to build & push a docker container instead of just building it and removed push-container Allow the PR to build & push a docker container instead of just building it deploy-pr-temp-env labels Jul 17, 2025
with suppress(asyncio.CancelledError):
await task # swallow the cancellation signal
try:
yield # app runs while the background task is alive
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the comments seems redundant, we understand what's going on here.

Copy link

This pull request has merge conflicts that must be resolved before it can be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@ix-56h ix-56h ix-56h requested changes

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /