don't pair a lobby user twice in a row

to gracefully handle clients that could send `poolIn`
after having gotten a game.

for veloce/lichobile#1781
pull/9470/head
Thibault Duplessis 2021-07-25 18:46:54 +02:00
parent 511a7a47f9
commit bc9473b9b6
1 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,8 @@ final private class PoolActor(
var members = Vector.empty[PoolMember]
private var lastPairedUserIds = Set.empty[User.ID]
var nextWave: Cancellable = _
implicit def ec = context.dispatcher
@ -34,6 +36,9 @@ final private class PoolActor(
def receive = {
case Join(joiner, _) if lastPairedUserIds(joiner.userId) =>
// don't pair someone twice in a row, it's probably a client error
case Join(joiner, rageSit) =>
members.find(joiner.is) match {
case None =>
@ -92,6 +97,8 @@ final private class PoolActor(
monitor.ratingDiff(monId).record(p.ratingDiff)
}
lastPairedUserIds = pairedMembers.view.map(_.userId).toSet
scheduleWave()
case Sris(sris) =>