-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Restart schedule on end #1767
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restart schedule on end #1767
Conversation
Stream("A", "B", "C") | ||
.scheduleWith(Schedule.recurs(3) *> Schedule.fromFunction((_) => "!"))(_.toLowerCase, identity) | ||
Stream("A", "B", "C", "A", "B", "C") | ||
.scheduleWith(Schedule.recurs(2) *> Schedule.fromFunction((_) => "Done"))(_.toLowerCase, identity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm why did it change to 2
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Schedule.recurs(2)
will consume three elements, as in the test for scheduleWith
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok let me wrap my head around this for a sec..running your state machine manually ;)
|
||
// The stream ends when both the underlying stream ends and the final | ||
// schedule value has been emitted | ||
case None => Pull.end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means that we don't emit the schedule's final value if the stream ended before the schedule ended. Is that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. If for instance the stream is completely empty, there never was a value of type a
to update the schedule.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I'm good with that 👍🏻
* Migrate StackBoolSpec to ZIO Tests (#1647) * Fix build issues introduced by bundling (#1754) * #1647 - converted SerializableSpec to ZTest (#1769) * Move PlatformLive.ExecutorUtil to Executor companion object. private zio.internal.Sync (#1770) * Modified dies signature (#1768) * Modified dies signature * Added type parameter * Removed type parameter * Restart schedule on end in ZStream#scheduleWith (#1767) * Restart schedule on end * Remove unused state, add docs * Port ZStream.fromInputStream to StreamEffect #1460 (#1772) * Port ZStream.fromInputStream (the one in platform.scala) to StreamEffect #1460 * Port ZStream.fromInputStream (the one in platform.scala) to StreamEffect #1460 * code review updates * code review updates * moved buffer to pull call, to avoid mutation * catch exception and use StreamEffectChunk * Specify that this fiber will be "inner interrupted" on joining an interrupted Fiber (#1774) * #1647: Migrate all tests to ZIO Test: Platform spec (#1775) * Migrate Fiber tests to ZIO Tests (#1647) (#1777) * Update zio-interop-java to 1.1.0.0-RC5 (#1781) * Update fs2-core to 2.0.1 (#1779) * Update sbt-pgp to 1.1.2 (#1780) * Update zio-interop-monix to 3.0.0.0-RC6 (#1782) * updated resources page to add my examples (#1783) * Migrate ZScheduleSpec to ZIO Tests (#1647)
Closes #1532
cc @iravid