Skip to content

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

Merged
merged 1 commit into from
Feb 9, 2017
Merged

Async executor "wait for pending futures" #102

merged 1 commit into from
Feb 9, 2017

Conversation

raix
Copy link
Contributor

@raix raix commented Jan 17, 2017

Wait for pending futures to return before returning as finished,

fixes #101

Wait for pending futures to return before returning as finished
@syrusakbary
Copy link
Member

Thanks for the fix!! :)

@syrusakbary syrusakbary merged commit a9744ae into graphql-python:master Feb 9, 2017
@janhancic
Copy link

@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 :)

@japrogramer
Copy link

japrogramer commented Jun 11, 2018

I think Im having these same issue in the latest graphene, please look at this
@raix
[this is the issue]
opened one in graphene-django to see if someone can help me
graphql-python/graphene-django#452

[earlier attempt]
This was an earlier attempt to get it to work with promise as a return type
graphql-python/graphene#551 (comment)

Copy link

@japrogramer japrogramer left a 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))

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)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

async resolvers in graphene breaks using nested structures
5 participants