-
Notifications
You must be signed in to change notification settings - Fork 180
Async executor "wait for pending futures" #102
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
Async executor "wait for pending futures" #102
Conversation
Thanks for the fix!! :) |
@raix @syrusakbary when is the next release? I'm hitting the same problem. I can patch it on our end for now, but would rather have an official release :) |
I think Im having these same issue in the latest graphene, please look at this [earlier attempt] |
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.
I think this might be helpfull when the event loop is already running ..
self.loop.run_until_complete(wait(self.futures)) | ||
futures = self.futures | ||
self.futures = [] | ||
self.loop.run_until_complete(wait(futures)) |
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.
Here Instead of calling run_until_complete it could call a friendlier method to those who already have loop running ..
async def wait_until_finished(self):
# if there are futures to wait for
if self.futures:
while self.futures:
# wait for the futures to finish
futures = self.futures
self.futures = []
self.loop.create_task(futures)
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.
Hi, I think this code here have some issues
We should give the timeout for the run_until_complete one right?
Or if the task not finished or something else wrong, the task just hang there, the self.futures will always be True, and stuck here.
Then the request is always pending.
Wait for pending futures to return before returning as finished,
fixes #101