resync round member when a message is missing
This commit is contained in:
parent
71bd5d2410
commit
d83ced489f
|
@ -22,7 +22,9 @@ private[round] final class History(ttl: Duration) extends Actor {
|
|||
case GetEventsSince(v: Int) ⇒ sender ! MaybeEvents(
|
||||
if (v > version) None
|
||||
else if (v == version) Some(Nil)
|
||||
else ((v + 1 to version).toList map get).flatten.some
|
||||
else ((v + 1 to version).toList map get).flatten |> { events ⇒
|
||||
(events.size == (version - v)) option events
|
||||
}
|
||||
)
|
||||
|
||||
case AddEvents(xs) ⇒ sender ! {
|
||||
|
|
|
@ -38,7 +38,7 @@ private[round] final class Socket(
|
|||
}
|
||||
withMember(uid) { member ⇒
|
||||
history ? GetEventsSince(v) foreach {
|
||||
case MaybeEvents(events) ⇒ events.fold(resync(member))(batch(member, _))
|
||||
case MaybeEvents(events) ⇒ events.fold(resyncNow(member))(batch(member, _))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -98,8 +98,8 @@ abstract class SocketActor[M <: SocketMember](uidTtl: Duration) extends Actor {
|
|||
import play.api.Play.current
|
||||
import scala.concurrent.duration._
|
||||
|
||||
Akka.system.scheduler.scheduleOnce((Random nextInt 4).seconds) {
|
||||
member.channel push resyncMessage
|
||||
Akka.system.scheduler.scheduleOnce((Random nextInt 3).seconds) {
|
||||
resyncNow(member)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -107,6 +107,10 @@ abstract class SocketActor[M <: SocketMember](uidTtl: Duration) extends Actor {
|
|||
withMember(uid)(resync)
|
||||
}
|
||||
|
||||
protected def resyncNow(member: M) {
|
||||
member.channel push resyncMessage
|
||||
}
|
||||
|
||||
def addMember(uid: String, member: M) {
|
||||
eject(uid)
|
||||
members = members + (uid -> member)
|
||||
|
|
1
todo
1
todo
|
@ -84,6 +84,7 @@ from MoralIntentions email:
|
|||
- The possibility of team matches (with solutions for players who are in several teams), where the team leader has to choose the board order, where the team results are shown and where the team player (who has played all of the games of the match) with the highest Percentage Score gets crowned Player of the Match of team "A".
|
||||
safari has high bounce rate
|
||||
tell, instead of asking, the round actor. it may send the events to the socket
|
||||
negociate resign and all with websockets
|
||||
|
||||
DEPLOY p21
|
||||
----------
|
||||
|
|
Loading…
Reference in a new issue