[RFC] SyncToAsync: use executor attribute#88
Conversation
|
Needs test adjustments (where the old method of changing the default executor is used). |
carltongibson
left a comment
There was a problem hiding this comment.
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.
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