Replies: 1 comment
-
They are not the same. The signature of def fromHubScoped[A](hub: => Hub[A]): ZIO[Scope, Nothing, ZStream[Any, Nothing, A]] Notice that it is an effect returning a stream. The documentation states:
So in the original example you are subscribing to the hub, then once you have subscribed to the hub you are completing the In contrast, in your example there is no guarantee that you have subscribed to the hub by the time you complete the promise. As a result, the publishers may publish their values before you are subscribed and you never see them, so you never receive two elements and suspend indefinitely. |
Beta Was this translation helpful? Give feedback.
-
I'm having issue with creating ZStream from Hub to receive messages that are published into the hub.
If I use example from the documentation with ZStream.fromHubScoped everything works
But if I try to use ZStream.fromHub() like below, basically same code:
after start it just hangs.
Beta Was this translation helpful? Give feedback.
All reactions