-
Notifications
You must be signed in to change notification settings - Fork 208
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
[RFC] SyncToAsync: use executor attribute #88
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please fix the lint errors :D
Needs test adjustments (where the old method of changing the default executor is used). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @blueyed. This seems reasonable(, if you're awaiting some kind of input before updating the tests.)
Adjusted the test. |
f26a9a3
to
667b48f
Compare
Rebased. |
This allows for overriding it easily in derived classes, and it seems to be better than changing the loop's default executor (in the case of ASGI_THREADS being set). Ref: django/channels#1091
This comment has been minimized.
This comment has been minimized.
monkeypatch.setenv("ASGI_THREADS", 99) | ||
orig_executor = async_function.executor | ||
async_function = sync_to_async(sync_function) | ||
assert async_function.executor is orig_executor |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this though: it might actually make sense to use a separate executor for every decorator?
This could also be achieved through a new kwarg.
how is this PR going? |
The PR is still marked as WIP so I'm going to close it to now as it's been over a year with no response from the author. |
Removed the (outdated) WIP label. |
This allows for overriding it easily in derived classes, and it seems to
be better than changing the loop's default executor (in the case of
ASGI_THREADS being set).
Ref: django/channels#1091