Fix FutureStream memory usage (#17395) [backport:1.2]
This commit is contained in:
parent
895a40d1ac
commit
9bb0e55749
1 changed files with 5 additions and 1 deletions
|
|
@ -127,7 +127,11 @@ proc read*[T](future: FutureStream[T]): owned(Future[(bool, T)]) =
|
||||||
resFut.complete(res)
|
resFut.complete(res)
|
||||||
|
|
||||||
# If the saved callback isn't nil then let's call it.
|
# If the saved callback isn't nil then let's call it.
|
||||||
if not savedCb.isNil: savedCb()
|
if not savedCb.isNil:
|
||||||
|
if fs.queue.len > 0:
|
||||||
|
savedCb()
|
||||||
|
else:
|
||||||
|
future.cb = savedCb
|
||||||
|
|
||||||
if future.queue.len > 0 or future.finished:
|
if future.queue.len > 0 or future.finished:
|
||||||
newCb(future)
|
newCb(future)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue