diff --git a/timeseries/src/main/scala/com/criteo/cuttle/timeseries/TimeSeriesApp.scala b/timeseries/src/main/scala/com/criteo/cuttle/timeseries/TimeSeriesApp.scala index 9c0b98965..12519889d 100644 --- a/timeseries/src/main/scala/com/criteo/cuttle/timeseries/TimeSeriesApp.scala +++ b/timeseries/src/main/scala/com/criteo/cuttle/timeseries/TimeSeriesApp.scala @@ -728,14 +728,14 @@ private[timeseries] case class TimeSeriesApp(project: CuttleProject, runningDependencies ++ failingDependencies ++ remainingDependenciesDeps.toSeq } - val watchedState = snapshotWatchedState() + val watchedState = IO(snapshotWatchedState()) if (request.headers.get(h"Accept").contains(h"text/event-stream")) { sse( - IO { Some(watchedState) }, + watchedState.map(Some(_)), (s: WatchedState) => getExecutions(s) ) } else { - getExecutions(watchedState).map(Ok(_)) + watchedState.flatMap(getExecutions).map(Ok(_)) } case GET at url"/api/timeseries/calendar/focus?start=$start&end=$end&jobs=$jobs" =>