{{ message }}
Repository navigation
Conversation
Contributor
CodSpeed Performance ReportMerging #14599 will not alter performanceComparing Summary
Footnotes |
YuriiMotov
requested changes
Jan 26, 2026
YuriiMotov
left a comment
Member
There was a problem hiding this comment.
@tsayin4, thank you for your interest!
This is a good idea to add such clarification and code example, but current implementation should be improved:
- Code examples should be placed in separate
.py-files and covered by tests - I think code examples should be updated:
- catch specific exceptions instead of
except Exception(that's considered as bad practice) - code example should be more meaningful - just catching the exception and logging it doesn't really change a lot (error traceback would be printed even without this logic)
- catch specific exceptions instead of
- I would also add console output for each example and some clarifications
Would you like to continue working on this?
Comment on lines
+95
to
+101
| !!! tip | ||
| For production systems with complex background jobs, consider: | ||
|
|
||
| - [Celery](https://docs.celeryq.dev) - Distributed task queue | ||
| - [arq](https://arq-docs.helpmanual.io/) - Async task queue for Python | ||
| - [Dramatiq](https://dramatiq.io/) - Fast and reliable task processing | ||
|
|
Member
There was a problem hiding this comment.
Suggested change
| !!! tip | |
| For production systems with complex background jobs, consider: | |
| - [Celery](https://docs.celeryq.dev) - Distributed task queue | |
| - [arq](https://arq-docs.helpmanual.io/) - Async task queue for Python | |
| - [Dramatiq](https://dramatiq.io/) - Fast and reliable task processing | |
| /// tip | |
| For production systems with complex background jobs, consider: | |
| - [Celery](https://docs.celeryq.dev) - Distributed task queue | |
| - [arq](https://arq-docs.helpmanual.io/) - Async task queue for Python | |
| - [Dramatiq](https://dramatiq.io/) - Fast and reliable task processing | |
| /// | |
Contributor
|
Heads-up: this will be closed in 3 days unless there's new activity. |
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds exception handling guidance to the BackgroundTasks tutorial to help users avoid silent failures in production.
Context
Several users have reported confusion around exception handling in BackgroundTasks:
Maintainers have previously noted that this behavior should be more explicit in the documentation.
Motivation
While building production systems, I explored async exception visibility patterns and noticed the same confusion affects FastAPI's BackgroundTasks. Exceptions in background tasks don't propagate to the response handler, which can lead to silent failures that are difficult to debug.
Changes
Adds a focused section to the BackgroundTasks tutorial explaining:
Scope
Happy to adjust wording or move this to a more appropriate section if you think that fits better.