I have the following ZIO program with two processes that both run forever:
for {
..
numberProvider <- numberProvider(queue).fork // runs forever
numberService <- numberService(queue) // runs forever
..
} yield ()
The above code works, but I was wondering if this is good practice.
There are 2 questions:
Is it ok, to run the 2. process on the main program. Or should it be also a Fiber?
Do I have to
join
the Fibers in the end, even if they run forever and therefore never reach thejoin
?for { .. numberProvider <- numberProvider(queue).fork // runs forever numberService <- numberService(queue) // runs forever .. _ <- numberProvider.join // join in any case } yield ()