Closed decaz closed 4 years ago
This should be handled in the watcher implementation https://github.com/micro-fan/aiozk/blob/master/aiozk/recipes/children_watcher.py But not all cases are covered in recipes tests, so it might not work.
If it isn't you can add test case for this case, it should be similar to https://github.com/micro-fan/aiozk/blob/master/aiozk/test/test_lock.py#L33
If I understand correct there should be some auxiliary task which handles connection losses and interacts with the main client loop. For instance:
while True:
await client.session.state.wait_for(States.SUSPENDED, States.LOST)
...
Am I right?
@decaz yes, you can use it, probably is better to have it implemented as
... asyncio.wait([watch_task, connection_lost], return_when=asyncio.FIRST_COMPLETED)
and then process response according to the fired event.
But all this should be the part of Watcher and ideally, you don't need to implement it by hands every time
Ok, thanks!
Part of example client:
In this case Client 1 doesn't get event so he won't continue the loop to the next iteration to update children list. Is there any proper way to handle such connection problems?