You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. I've been playing with ExplicitlyTriggeredScheduler and noticed it doesn't behave as you might expect if you integrate its usage with some of the streams operators. For example, in the code below you'd naively expect the probe to receive a timeout as a result of calling scheduler.timePasses, but no such timeout is received.
importscala.concurrent.duration.DurationIntimportakka.actor.ActorSystemimportakka.stream.scaladsl.Sourceimportakka.stream.testkit.scaladsl.TestSinkimportakka.testkit.ExplicitlyTriggeredSchedulerimportcom.typesafe.config.ConfigFactoryobjectReproductionextendsApp {
implicitvalsystem:ActorSystem=ActorSystem(
"test",
config =Some(ConfigFactory.parseString(
"""akka.scheduler.implementation = "akka.testkit.ExplicitlyTriggeredScheduler""""
))
)
valscheduler= system.scheduler.asInstanceOf[ExplicitlyTriggeredScheduler]
valprobe=Source.never.idleTimeout(10.seconds).runWith(TestSink.probe)
scheduler.timePasses(20.seconds)
// Exception in thread "main" java.lang.AssertionError: assertion failed: timeout (3 seconds) during expectMsgClass waiting for class akka.stream.testkit.TestSubscriber$OnError
probe.expectSubscriptionAndError()
}
The reason for this is that a number of stream operators, including Idle, work by inspecting the system time when the background timer expires.
There's no documentation suggesting streams should play nicely with ExplicitlyTriggeredScheduler, but I thought I'd raise this for awareness anyway.
The text was updated successfully, but these errors were encountered:
Hi. I've been playing with
ExplicitlyTriggeredScheduler
and noticed it doesn't behave as you might expect if you integrate its usage with some of the streams operators. For example, in the code below you'd naively expect the probe to receive a timeout as a result of callingscheduler.timePasses
, but no such timeout is received.The reason for this is that a number of stream operators, including
Idle
, work by inspecting the system time when the background timer expires.There's no documentation suggesting streams should play nicely with
ExplicitlyTriggeredScheduler
, but I thought I'd raise this for awareness anyway.The text was updated successfully, but these errors were encountered: