From bb5da0b8c3f6cea938b0630048af737ee05913ce Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Tue, 5 Oct 2021 12:57:56 +0200 Subject: perf(simulator): Ignore sync pulls without changes --- .../org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'opendc-simulator/opendc-simulator-flow') diff --git a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt index f15d7fb0..9a568897 100644 --- a/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt +++ b/opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt @@ -182,7 +182,11 @@ internal class FlowConsumerContextImpl( return } - engine.scheduleSync(_clock.millis(), this) + val now = _clock.millis() + + if (flags and (ConnPulled or ConnPushed) != 0 || _deadline == now) { + engine.scheduleSync(now, this) + } } override fun push(rate: Double) { -- cgit v1.2.3