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
accept loop parameter for Queue #297
Conversation
Use case: If one wants to create the Queue in the main thread of the app, but use it with loop that running in a thread (not the one in the main thread). Otw. I have to create the queue in the thread to pick up the correct loop.
Codecov Report
@@ Coverage Diff @@
## master #297 +/- ##
=======================================
Coverage 95.52% 95.52%
=======================================
Files 4 4
Lines 1274 1274
Branches 84 84
=======================================
Hits 1217 1217
Misses 50 50
Partials 7 7
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
Your request is error-prone, sorry. |
then how do you want to run the queue in its own thread? |
Create a queue instance in that thread than, that is what I can suggest |
yes, that is exactly the issue, many of python async functions accept loop parameter, what is error prone about this? |
In asyncio from Python 3.10 only two or three such public functions are left, all others were deprecated the loop argument by 3.8 and removed in 3.10 |
the problem is |
The latest janus maybe doesn't fit your (not published) code, sure. |
@ali5h Thanks for this snippet. I setup a new system with old Python 3.7 code & janus 0.4.0 on Python 3.8 & janus 0.6.1, and this was the only change which bit me. Patched the janus init.py with the suggested change and it works fine - good enough for another handful of years. I'm sure this isn't best practice asyncio use for modern Python, but it's a lot lower friction than upgrading the rest of the codebase. |
What do these changes do?
Use case: If one wants to create the Queue in the main thread of the app, but use
it with an async loop that is running in a thread (not the one in the main thread).
Otw. one would have to create the queue in the thread to pick up the correct loop.
Are there changes in behavior for the user?
no change in behavior if used as before. Now user can pass a custom loop.
Checklist
CHANGES
folderThis change is