Properly propagate loop. Fixes #420.

This commit is contained in:
Rapptz
2016-12-21 00:01:00 -05:00
parent 5731f3405d
commit bed2e90e82
4 changed files with 12 additions and 9 deletions

View File

@@ -519,8 +519,8 @@ class Client:
self.loop.run_until_complete(self.start(*args, **kwargs))
except KeyboardInterrupt:
self.loop.run_until_complete(self.logout())
pending = asyncio.Task.all_tasks()
gathered = asyncio.gather(*pending)
pending = asyncio.Task.all_tasks(loop=self.loop)
gathered = asyncio.gather(*pending, loop=self.loop)
try:
gathered.cancel()
self.loop.run_until_complete(gathered)
@@ -1393,7 +1393,7 @@ class Client:
to_delete = ret[-100:]
yield from self.delete_messages(to_delete)
count = 0
yield from asyncio.sleep(1)
yield from asyncio.sleep(1, loop=self.loop)
if check(msg):
count += 1