Skip to content

Commit 46a98f8

Browse files
authored
Merge pull request #3188 from armanbilge/topic/fix-flaky-timed-doctest
Slower sleep+timeout for `timed` doctest
2 parents 4d95770 + 635e33b commit 46a98f8

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

core/shared/src/main/scala/fs2/Stream.scala

+3-3
Original file line numberDiff line numberDiff line change
@@ -4723,17 +4723,17 @@ object Stream extends StreamLowPriority {
47234723
*
47244724
* As a quick example, let's write a timed pull which emits the
47254725
* string "late!" whenever a chunk of the stream is not emitted
4726-
* within 450 milliseconds:
4726+
* within 1 second:
47274727
*
47284728
* @example {{{
47294729
* scala> import cats.effect.IO
47304730
* scala> import cats.effect.unsafe.implicits.global
47314731
* scala> import scala.concurrent.duration._
4732-
* scala> val s = (Stream("elem") ++ Stream.sleep_[IO](600.millis)).repeat.take(3)
4732+
* scala> val s = (Stream("elem") ++ Stream.sleep_[IO](1500.millis)).repeat.take(3)
47334733
* scala> s.pull
47344734
* | .timed { timedPull =>
47354735
* | def go(timedPull: Pull.Timed[IO, String]): Pull[IO, String, Unit] =
4736-
* | timedPull.timeout(450.millis) >> // starts new timeout and stops the previous one
4736+
* | timedPull.timeout(1.second) >> // starts new timeout and stops the previous one
47374737
* | timedPull.uncons.flatMap {
47384738
* | case Some((Right(elems), next)) => Pull.output(elems) >> go(next)
47394739
* | case Some((Left(_), next)) => Pull.output1("late!") >> go(next)

io/jvm/src/test/scala/fs2/io/file/WatcherSuite.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class WatcherSuite extends Fs2Suite with BaseFileSuite {
168168
}
169169

170170
private def smallDelay: Stream[IO, Nothing] =
171-
Stream.sleep_[IO](100.millis)
171+
Stream.sleep_[IO](1.second)
172172

173173
// Tries to load the Oracle specific SensitivityWatchEventModifier to increase sensitivity of polling
174174
private val modifiers: Seq[WatchEvent.Modifier] =

0 commit comments

Comments
 (0)