Skip to content

Commit

Permalink
broadcast started game cache with sync.delay
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Jun 29, 2024
1 parent 362ba23 commit e01aa50
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion modules/relay/src/main/RelayFetch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions modules/relay/src/main/RelayRound.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit e01aa50

Please sign in to comment.