add puzzle batch logging

This commit is contained in:
Thibault Duplessis 2018-03-09 09:11:36 -05:00
parent 76acfe2bfe
commit 891be29d38
2 changed files with 11 additions and 4 deletions

View file

@ -79,11 +79,15 @@ private[puzzle] final class Finisher(
rating = formerUserRating,
ratingDiff = userPerf.intRating - formerUserRating
)
bus.publish(Puzzle.UserResult(puzzle.id, user.id, result, formerUserRating -> userPerf.intRating), 'finishPuzzle)
(api.round add a) >>
UserRepo.setPerf(user.id, PerfType.Puzzle, userPerf) inject
user.copy(perfs = user.perfs.copy(puzzle = userPerf))
UserRepo.setPerf(user.id, PerfType.Puzzle, userPerf) >>-
bus.publish(
Puzzle.UserResult(puzzle.id, user.id, result, formerUserRating -> userPerf.intRating),
'finishPuzzle
) inject
user.copy(perfs = user.perfs.copy(puzzle = userPerf))
} recover lila.db.recoverDuplicateKey { _ =>
logger.info(s"ratedUntrusted ${user.id} ${puzzle.id} duplicate round")
user // has already been solved!
}

View file

@ -20,7 +20,10 @@ private[puzzle] final class PuzzleBatch(
_ <- data.solutions.lastOption ?? { lastSolution =>
api.head.solved(user, lastSolution.id).void
}
} yield ()
} yield for {
first <- puzzles.headOption.flatten
last <- puzzles.lastOption.flatten
} logger.info(s"Batch solve ${user.id} ${puzzles.size} ${first.id}->${last.id}")
object select {