diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-10-05 12:57:56 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2021-10-05 16:56:46 +0200 |
| commit | bb5da0b8c3f6cea938b0630048af737ee05913ce (patch) | |
| tree | 8c8fb65b82647918b6ed7e43d8920082fb622701 /opendc-simulator | |
| parent | 0ec821157767a630ff82f980f4990ec9d1b75573 (diff) | |
perf(simulator): Ignore sync pulls without changes
Diffstat (limited to 'opendc-simulator')
| -rw-r--r-- | opendc-simulator/opendc-simulator-flow/src/main/kotlin/org/opendc/simulator/flow/internal/FlowConsumerContextImpl.kt | 6 |
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) { |
