Skip to content

Commit

Permalink
fix relay sync.period
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Apr 23, 2023
1 parent 5f253cc commit d32f7f4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions app/views/relay/roundForm.scala
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ object roundForm:
)(form3.flatpickr(_, minDate = None)),
isGranted(_.Relay) option
form3.group(
form("throttle"),
raw("Throttle in seconds"),
help = raw("Optional, to manually throttle requests. Min 2s, max 60s.").some,
form("period"),
raw("Period in seconds"),
help = raw(
"Optional, how long to wait between requests. Min 2s, max 60s. Defaults to automatic based on the number of viewers."
).some,
half = true
)(form3.input(_, typ = "number"))
),
Expand Down
4 changes: 2 additions & 2 deletions modules/relay/src/main/RelayFetch.scala
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ final private class RelayFetch(
.filterNot(_ contains "Found an empty PGN")
.foreach { irc.broadcastError(rt.round.id.value, rt.fullName, _) }
Seconds(60)
else rt.round.sync.delay | Seconds(if upstream.local then 3 else 6)
else rt.round.sync.period | Seconds(if upstream.local then 3 else 6)
rt.round.withSync {
_.copy(
nextAt = nowInstant plusSeconds {
Expand Down Expand Up @@ -144,7 +144,7 @@ final private class RelayFetch(
gameProxy.upgradeIfPresent flatMap
gameRepo.withInitialFens flatMap { games =>
if (games.size == ids.size)
games.map { case (game, fen) =>
games.map { (game, fen) =>
pgnDump(game, fen, gameIdsUpstreamPgnFlags).dmap(_.render)
}.parallel dmap MultiPgn.apply
else
Expand Down

0 comments on commit d32f7f4

Please sign in to comment.