summaryrefslogtreecommitdiff
path: root/opendc-simulator/opendc-simulator-flow/src/main
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-10-05 12:57:56 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-10-05 16:56:46 +0200
commitbb5da0b8c3f6cea938b0630048af737ee05913ce (patch)
tree8c8fb65b82647918b6ed7e43d8920082fb622701 /opendc-simulator/opendc-simulator-flow/src/main
parent0ec821157767a630ff82f980f4990ec9d1b75573 (diff)
perf(simulator): Ignore sync pulls without changes
Diffstat (limited to 'opendc-simulator/opendc-simulator-flow/src/main')
-rw-r--r--opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt6
1 files changed, 5 insertions, 1 deletions
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) {