Await task after cancelling it.
This commit is contained in:
parent
95bb1588ab
commit
dc74c869a1
@ -139,11 +139,11 @@ class ServerManager(LoggedClass):
|
|||||||
while True:
|
while True:
|
||||||
task = await self.tasks.get()
|
task = await self.tasks.get()
|
||||||
try:
|
try:
|
||||||
if task.session in self.sessions:
|
if not task.session in self.sessions:
|
||||||
self.current_task = task
|
self.logger.info('cancelling task of gone session')
|
||||||
await task.job
|
|
||||||
else:
|
|
||||||
task.job.cancel()
|
task.job.cancel()
|
||||||
|
self.current_task = task
|
||||||
|
await task.job
|
||||||
except asyncio.CancelledError:
|
except asyncio.CancelledError:
|
||||||
self.logger.info('cancelled task noted')
|
self.logger.info('cancelled task noted')
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user