Closed Vinchethescript closed 1 year ago
Also, when I tried to put some prints to find out where it gets stuck
def waiter(client):
async def wait_for(*events, return_when=asyncio.FIRST_COMPLETED):
print(1)
if not events:
return
print(2)
done, pending = await asyncio.wait(
[client.wait(event) for event in events],
loop=client.loop,
return_when=return_when,
)
print(3)
# Get the result(s) of the completed task(s).
ret = [future.result() for future in done]
# Cancel any events that didn't come in.
for future in pending:
future.cancel()
# Return list of completed event names.
return ret
return wait_for
it looped 1
and 2
, so the output was like this:
1
2
1 # after some seconds
2
1 # same as before
2
1
2
...
It looks like it re-runs the function if there is a problem
The client is not connecting to freenode. Here's my code:
I tried this on another PC and it worked.