Skip to content

Commit

Permalink
better broadcast error reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
ornicar committed Jun 27, 2024
1 parent a58219e commit 72ec470
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 3 additions & 4 deletions modules/relay/src/main/RelayListing.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ final class RelayListing(
local = "_id",
foreign = "tourId",
pipe = List(
$doc("$match" -> $doc("finished" -> false)),
$doc("$addFields" -> $doc("sync.log" -> $arr())),
$doc("$sort" -> RelayRoundRepo.sort.chrono),
$doc("$limit" -> 1)
$doc("$match" -> $doc("finished" -> false)),
$doc("$sort" -> RelayRoundRepo.sort.chrono),
$doc("$limit" -> 1)
)
)
for
Expand Down
8 changes: 7 additions & 1 deletion modules/relay/src/main/RelayTour.scala
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,13 @@ object RelayTour:
display: RelayRound, // which round to show on the tour link
link: RelayRound, // which round to actually link to
group: Option[RelayGroup.Name]
) extends RelayRound.AndTourAndGroup
) extends RelayRound.AndTourAndGroup:
def errors: List[String] =
val round = display
~round.sync.log.lastErrors.some
.filter(_.nonEmpty)
.orElse:
(round.hasStarted && !round.sync.ongoing).option(List("Not syncing!"))

case class WithLastRound(tour: RelayTour, round: RelayRound, group: Option[RelayGroup.Name])
extends RelayRound.AndTourAndGroup:
Expand Down
2 changes: 1 addition & 1 deletion modules/relay/src/main/ui/RelayTourUi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ final class RelayTourUi(helpers: Helpers, ui: RelayUi):
)

private def adminIndex(active: List[RelayTour.ActiveWithSomeRounds])(using Context) =
val errored = active.flatMap(a => a.link.sync.log.lastErrors.some.filter(_.nonEmpty).map(a -> _))
val errored = active.flatMap(a => a.errors.some.filter(_.nonEmpty).map(a -> _))
errored.nonEmpty.option:
div(cls := "relay-index__admin")(
h2("Ongoing broadcasts with errors"),
Expand Down

0 comments on commit 72ec470

Please sign in to comment.