Skip to content

Commit

Permalink
fixed potential bug in js stream, when we reading from finished stream
Browse files Browse the repository at this point in the history
  • Loading branch information
rssh committed May 20, 2024
1 parent 50b086b commit e0e35e8
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,12 @@ trait BaseUnfoldCpsAsyncEmitAbsorber[R,F[_],C<:CpsMonadContext[F], T](using ec:
val e = state.supplyEvents.dequeue()
asyncMonad.pure(e)
else
state.queueConsumer()

state.finishRef.get() match
case null =>
state.queueConsumer()
case finished =>
asyncMonad.pure(Finished(finished))

val r = state.finishRef.get()
if r eq null then
asyncMonad.flatMap(nextEvent())(e => handleEvent(e))
Expand Down

0 comments on commit e0e35e8

Please sign in to comment.