mirror of https://github.com/nocturn9x/giambio.git
The loop now removes exited tasks from self.tasks
This commit is contained in:
parent
e4a4c45f65
commit
a472116686
|
@ -228,6 +228,7 @@ class AsyncScheduler:
|
||||||
self.current_task.result = ret.value
|
self.current_task.result = ret.value
|
||||||
self.current_task.finished = True
|
self.current_task.finished = True
|
||||||
self.join(self.current_task)
|
self.join(self.current_task)
|
||||||
|
self.tasks.remove(self.current_task)
|
||||||
except BaseException as err:
|
except BaseException as err:
|
||||||
# Our handy join mechanism will handle all the hassle of
|
# Our handy join mechanism will handle all the hassle of
|
||||||
# rescheduling joiners and propagating errors, so we
|
# rescheduling joiners and propagating errors, so we
|
||||||
|
@ -235,6 +236,7 @@ class AsyncScheduler:
|
||||||
# self.join() work its magic
|
# self.join() work its magic
|
||||||
self.current_task.exc = err
|
self.current_task.exc = err
|
||||||
self.join(self.current_task)
|
self.join(self.current_task)
|
||||||
|
self.tasks.remove(self.current_task)
|
||||||
|
|
||||||
def create_task(self, corofunc: types.FunctionType, pool, *args, **kwargs) -> Task:
|
def create_task(self, corofunc: types.FunctionType, pool, *args, **kwargs) -> Task:
|
||||||
"""
|
"""
|
||||||
|
@ -687,6 +689,7 @@ class AsyncScheduler:
|
||||||
task.status = "cancelled"
|
task.status = "cancelled"
|
||||||
self.io_release_task(self.current_task)
|
self.io_release_task(self.current_task)
|
||||||
self.debugger.after_cancel(task)
|
self.debugger.after_cancel(task)
|
||||||
|
self.tasks.remove(self.current_task)
|
||||||
else:
|
else:
|
||||||
# If the task ignores our exception, we'll
|
# If the task ignores our exception, we'll
|
||||||
# raise it later again
|
# raise it later again
|
||||||
|
|
Loading…
Reference in New Issue