Skip to content

Commit

Permalink
Fixing duration on multiple passed check windows
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Peter <[email protected]>
  • Loading branch information
sebastian-peter committed Oct 14, 2024
1 parent 3e8d49d commit 1a05221
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/main/scala/edu/ie3/simona/scheduler/RuntimeNotifier.scala
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@ final case class RuntimeNotifier(
val completedWindows =
(adjustedLastCheck + checkWindow) to completedTick by checkWindow

completedWindows.foreach { tick =>
notify(
CheckWindowPassed(tick, duration(lastCheckWindowTime, nowTime))
)
completedWindows.foldLeft(lastCheckWindowTime) {
case (lastTime, tick) =>
notify(
CheckWindowPassed(tick, duration(lastTime, nowTime))
)
None
}

completedWindows.lastOption
Expand Down

0 comments on commit 1a05221

Please sign in to comment.