Workaround for multiple `waitFor` where `await` must be used.
Bump version to 2.0.7.
This commit is contained in:
parent
293f993bed
commit
7718ebe1ee
|
@ -1,5 +1,5 @@
|
|||
packageName = "asyncdispatch2"
|
||||
version = "2.0.6"
|
||||
version = "2.0.7"
|
||||
author = "Status Research & Development GmbH"
|
||||
description = "Asyncdispatch2"
|
||||
license = "Apache License 2.0 or MIT"
|
||||
|
|
|
@ -227,6 +227,12 @@ template processTimers(loop: untyped) =
|
|||
template processCallbacks(loop: untyped) =
|
||||
var count = len(loop.callbacks)
|
||||
for i in 0..<count:
|
||||
# This is mostly workaround for people which are using `waitFor` where
|
||||
# it must be used `await`. While using `waitFor` inside of callbacks
|
||||
# dispatcher's callback list is got decreased and length of
|
||||
# `loop.callbacks` become not equal to `count`, its why `IndexError`
|
||||
# can be generated.
|
||||
if len(loop.callbacks) == 0: break
|
||||
let callable = loop.callbacks.popFirst()
|
||||
callable.function(callable.udata)
|
||||
|
||||
|
|
Loading…
Reference in New Issue