-
Notifications
You must be signed in to change notification settings - Fork 828
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
Vendor DataLoader
from aiodataloader
and move get_event_loop()
out of __init__
function.
#1459
Vendor DataLoader
from aiodataloader
and move get_event_loop()
out of __init__
function.
#1459
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1459 +/- ##
==========================================
+ Coverage 95.44% 95.72% +0.27%
==========================================
Files 49 50 +1
Lines 1582 1683 +101
==========================================
+ Hits 1510 1611 +101
Misses 72 72
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
DataLoader
from aiodataloader
and move get_event_loop() out of __init__
function.DataLoader
from aiodataloader
and move get_event_loop()
out of __init__
function.
@@ -2,6 +2,10 @@ | |||
exclude = setup.py,docs/*,*/examples/*,graphene/pyutils/*,tests | |||
max-line-length = 120 | |||
|
|||
# This is a specific ignore for Black+Flake8 | |||
# source: https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#id1 | |||
extend-ignore = E203 |
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.
without this line, flake8 was constantly clashing with black over array slice notation whitespacing rules.
Seems like |
…avior from `__init__` to a property which only gets resolved when actually needed (this will solve PyTest-related early get_event_loop() issues)
…executed by pytest.
…ility to pass in a custom event loop, if needed.
DataLoaders are trying to get the asyncio's event loop too early (on
__init__
) and this is generating problems like making pytest + async unusable. Since there is no event loop at that moment, the first DataLoader instantiated is actually creating a new event loop. This generates the infamous "Future tied to a different loop" problem many people are facing.In this PR, we are:
aiodataloader
'sDataLoader
class into theutils/
moduleget_event_loop
out of the class' initializer and into a property which only gets called when actually needed, offsetting the chicken-and-egg problem we are dealing with.The base for this work is dataloader.py, which is MIT Licensed code from Syrus Akbary