From e01aa50c6eb2871f8ca20b81b161e0fb4e78e371 Mon Sep 17 00:00:00 2001 From: Thibault Duplessis Date: Sat, 29 Jun 2024 13:28:26 +0200 Subject: [PATCH] broadcast started game cache with sync.delay --- modules/relay/src/main/RelayFetch.scala | 2 +- modules/relay/src/main/RelayRound.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/relay/src/main/RelayFetch.scala b/modules/relay/src/main/RelayFetch.scala index 975662175b5d..ac157f053e4a 100644 --- a/modules/relay/src/main/RelayFetch.scala +++ b/modules/relay/src/main/RelayFetch.scala @@ -267,7 +267,7 @@ final private class RelayFetch( httpGetPgn(url).map { MultiPgn.split(_, RelayFetch.maxChapters) }.flatMap(multiPgnToGames.future) case RelayFormat.LccWithGames(lcc) => httpGetJson[RoundJson](lcc.indexUrl).flatMap: round => - val nearStart = rt.round.secondsAfterStart.exists(_ < 300) + val nearStart = rt.round.secondsAfterSyncStart.exists(_ < 300) round.pairings .mapWithIndex: (pairing, i) => val game = i + 1 diff --git a/modules/relay/src/main/RelayRound.scala b/modules/relay/src/main/RelayRound.scala index 6e6bd03a87f7..585404730602 100644 --- a/modules/relay/src/main/RelayRound.scala +++ b/modules/relay/src/main/RelayRound.scala @@ -58,11 +58,11 @@ case class RelayRound( def withTour(tour: RelayTour) = RelayRound.WithTour(this, tour) - def secondsAfterStart: Option[Seconds] = + def secondsAfterSyncStart: Option[Seconds] = startedAt .orElse(startsAt) .map: start => - (nowSeconds - start.toSeconds).toInt + (nowSeconds - start.toSeconds - sync.delay.so(_.value)).toInt .filter(0 < _) .map(Seconds.apply)