-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
Love what you made. I've been wanting to figure this out for a while, but have been hesitant to ask.
Can you help me with this.., not sure if I'm understanding how to use get_hub().switch() correctly.
Here is an example of what I'm trying to accomplish..
def prepare_handle(self, ph):
print('prepare handle self.users %s' % self.users)
def handle_response(future, user):
print('future %s' % future)
request = cURLHTTPRequest('http://google.com')
future = self.client.req(request)
# gruvi.get_hub().switch()
with gruvi.switch_back(timeout=10) as switcher:
print('here!!!')
sigh = pyuv.Signal(gruvi.get_hub().loop)
sigh.start(switcher, pyuv.Signal().SIGHUP)
future.add_done_callback(functools.partial(switcher, future, 'asdf'))
switcher.add_cleanup(sigh.close)
gruvi.get_hub().switch()
So combining Fibers & (ultimately) results of the values of Futures. Didn't see any examples using gruvi.get_hub().switch() AND switchback.
MUCH appreciated.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels