Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Making thread_sensitive=True the default
This makes thread_sensitive=True the default behaviour for SyncToAsync. It's easy to run afoul of thread-sensitive code when dealing with databases or frameworks like Django, and while the penalty for having this on by default is just slightly worse performance, the penalty for having it off is very confusing bugs all over the place - so, to keep with the Django culture of safety first, it's best to default this on. Additionally, this allows thread_sensitive to be passed into the `sync_to_async` decorator, so if people are sure their code is safe and want to run it in its own thread for performance reasons, they can use `@sync_to_async(thread_sensitive=False)`.
- Loading branch information
1 parent
66a6e68
commit 7becc9d
Showing
3 changed files
with
44 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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