Merge branch 'master' into lobbyMithril
* master: es "español, castellano" translation #11440. Author: n_espindola. Phrase 290. I just added an accent mark. attempt to fix memory leak by making simul cache synchronous add reboot script Adding chess module with invalid two opposing bishops on same color diagonal stalemate condition in antichess fix.
This commit is contained in:
commit
b465f3f028
|
@ -95,17 +95,16 @@ object User extends LilaController {
|
|||
|
||||
private def userGames(u: UserModel, filterOption: Option[String], page: Int)(implicit ctx: Context) = {
|
||||
import lila.app.mashup.GameFilter.{ All, Playing }
|
||||
filterOption.fold({
|
||||
Env.game.cached isPlayingSimul u.id map (_.fold(Playing, All).name)
|
||||
})(fuccess) flatMap { filterName =>
|
||||
GameFilterMenu.paginatorOf(
|
||||
user = u,
|
||||
info = none,
|
||||
filter = GameFilterMenu.currentOf(GameFilterMenu.all, filterName),
|
||||
me = ctx.me,
|
||||
page = page
|
||||
) map { html.user.games(u, _, filterName) }
|
||||
val filterName = filterOption | {
|
||||
Env.game.cached.isPlayingSimul(u.id).fold(Playing, All).name
|
||||
}
|
||||
GameFilterMenu.paginatorOf(
|
||||
user = u,
|
||||
info = none,
|
||||
filter = GameFilterMenu.currentOf(GameFilterMenu.all, filterName),
|
||||
me = ctx.me,
|
||||
page = page
|
||||
) map { html.user.games(u, _, filterName) }
|
||||
}
|
||||
|
||||
def list = Open { implicit ctx =>
|
||||
|
|
|
@ -59,25 +59,23 @@ object UserInfo {
|
|||
(ctx.me ?? Granter(_.UserSpy) ?? { relationApi.nbBlockers(user.id) map (_.some) }) zip
|
||||
postApi.nbByUser(user.id) zip
|
||||
isDonor(user.id) zip
|
||||
PlayTime(user) flatMap {
|
||||
PlayTime(user) map {
|
||||
case (((((((((((nbUsers, ranks), nbPlaying), nbImported), crosstable), ratingChart), nbFollowing), nbFollowers), nbBlockers), nbPosts), isDonor), playTime) =>
|
||||
(nbPlaying > 0) ?? gameCached.isPlayingSimul(user.id) map { hasSimul =>
|
||||
new UserInfo(
|
||||
user = user,
|
||||
ranks = ranks,
|
||||
nbUsers = nbUsers,
|
||||
nbPlaying = nbPlaying,
|
||||
hasSimul = hasSimul,
|
||||
crosstable = crosstable,
|
||||
nbBookmark = bookmarkApi countByUser user,
|
||||
nbImported = nbImported,
|
||||
ratingChart = ratingChart,
|
||||
nbFollowing = nbFollowing,
|
||||
nbFollowers = nbFollowers,
|
||||
nbBlockers = nbBlockers,
|
||||
nbPosts = nbPosts,
|
||||
playTime = playTime,
|
||||
donor = isDonor)
|
||||
}
|
||||
new UserInfo(
|
||||
user = user,
|
||||
ranks = ranks,
|
||||
nbUsers = nbUsers,
|
||||
nbPlaying = nbPlaying,
|
||||
hasSimul = (nbPlaying > 0 && gameCached.isPlayingSimul(user.id)),
|
||||
crosstable = crosstable,
|
||||
nbBookmark = bookmarkApi countByUser user,
|
||||
nbImported = nbImported,
|
||||
ratingChart = ratingChart,
|
||||
nbFollowing = nbFollowing,
|
||||
nbFollowers = nbFollowers,
|
||||
nbBlockers = nbBlockers,
|
||||
nbPosts = nbPosts,
|
||||
playTime = playTime,
|
||||
donor = isDonor)
|
||||
}
|
||||
}
|
||||
|
|
20
bin/prod/reboot
Executable file
20
bin/prod/reboot
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh
|
||||
. bin/lilarc
|
||||
|
||||
REMOTE="frank"
|
||||
|
||||
lilalog "Notify users of pre deploy"
|
||||
bin/cli-prod deploy pre
|
||||
|
||||
sleep 60
|
||||
|
||||
lilalog "Notify users of post deploy"
|
||||
bin/cli-prod deploy post
|
||||
|
||||
lilalog "Restart lichess"
|
||||
ssh $REMOTE "service lichess restart"
|
||||
|
||||
lilalog "Deploy complete"
|
||||
|
||||
sleep 2
|
||||
curl_prod
|
|
@ -287,7 +287,7 @@ clickToSolve=Clica para resolver
|
|||
goodMove=Buena jugada
|
||||
butYouCanDoBetter=Pero puedes hacerlo mejor.
|
||||
bestMove=El mejor movimiento!
|
||||
keepGoing=Vamos, continua...
|
||||
keepGoing=Vamos, continúa...
|
||||
puzzleFailed=Ejercicio fallido
|
||||
butYouCanKeepTrying=Pero puedes intentarlo de nuevo
|
||||
victory=¡Victoria!
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e17725849f8e1527f95aacdd6f0e3391069da119
|
||||
Subproject commit 6133fd97308de76345ab901dbf4fc97772fdd843
|
|
@ -7,7 +7,7 @@ import play.api.libs.json.JsObject
|
|||
|
||||
import lila.db.api.$count
|
||||
import lila.db.BSON._
|
||||
import lila.memo.{ AsyncCache, MongoCache, ExpireSetMemo, Builder }
|
||||
import lila.memo.{ AsyncCache, MixedCache, MongoCache, ExpireSetMemo, Builder }
|
||||
import lila.user.{ User, UidNb }
|
||||
import tube.gameTube
|
||||
import UidNb.UidNbBSONHandler
|
||||
|
@ -25,11 +25,12 @@ final class Cached(
|
|||
|
||||
private implicit val userHandler = User.userBSONHandler
|
||||
|
||||
private val isPlayingSimulCache = AsyncCache[String, Boolean](
|
||||
private val isPlayingSimulCache = MixedCache[String, Boolean](
|
||||
f = userId => GameRepo.countPlayingRealTime(userId) map (1 <),
|
||||
timeToLive = 10.seconds)
|
||||
timeToLive = 15.seconds,
|
||||
default = _ => false)
|
||||
|
||||
val isPlayingSimul: String => Fu[Boolean] = isPlayingSimulCache.apply _
|
||||
val isPlayingSimul: String => Boolean = isPlayingSimulCache.get
|
||||
|
||||
val rematch960 = new ExpireSetMemo(3.hours)
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ final class Env(
|
|||
prefApi: lila.pref.PrefApi,
|
||||
chatApi: lila.chat.ChatApi,
|
||||
historyApi: lila.history.HistoryApi,
|
||||
isPlayingSimul: String => Fu[Boolean],
|
||||
isPlayingSimul: String => Boolean,
|
||||
scheduler: lila.common.Scheduler) {
|
||||
|
||||
private val settings = new {
|
||||
|
@ -71,6 +71,8 @@ final class Env(
|
|||
}: Receive) orElse actorMapReceive
|
||||
}), name = ActorMapName)
|
||||
|
||||
scheduler.message(2.1 seconds)(roundMap -> actorApi.GetNbRounds)
|
||||
|
||||
private var nbRounds = 0
|
||||
def count() = nbRounds
|
||||
|
||||
|
@ -161,12 +163,6 @@ final class Env(
|
|||
|
||||
lazy val noteApi = new NoteApi(db(CollectionNote))
|
||||
|
||||
{
|
||||
import scala.concurrent.duration._
|
||||
|
||||
scheduler.message(2.1 seconds)(roundMap -> actorApi.GetNbRounds)
|
||||
}
|
||||
|
||||
system.actorOf(
|
||||
Props(classOf[Titivate], roundMap, hub.actor.bookmark),
|
||||
name = "titivate")
|
||||
|
|
|
@ -27,7 +27,7 @@ private[round] final class Socket(
|
|||
socketTimeout: Duration,
|
||||
disconnectTimeout: Duration,
|
||||
ragequitTimeout: Duration,
|
||||
isPlayingSimul: String => Fu[Boolean]) extends SocketActor[Member](uidTimeout) {
|
||||
isPlayingSimul: String => Boolean) extends SocketActor[Member](uidTimeout) {
|
||||
|
||||
private var hasAi = false
|
||||
|
||||
|
@ -43,7 +43,7 @@ private[round] final class Socket(
|
|||
var userId = none[String]
|
||||
|
||||
def ping {
|
||||
isGone foreach { _ ?? notifyGone(color, false) }
|
||||
if (isGone) notifyGone(color, false)
|
||||
if (bye > 0) bye = bye - 1
|
||||
time = nowMillis
|
||||
}
|
||||
|
@ -52,10 +52,9 @@ private[round] final class Socket(
|
|||
}
|
||||
private def isBye = bye > 0
|
||||
|
||||
def isGone =
|
||||
if (time < (nowMillis - isBye.fold(ragequitTimeout, disconnectTimeout).toMillis))
|
||||
(userId ?? isPlayingSimul) map (!_)
|
||||
else fuccess(false)
|
||||
def isGone = {
|
||||
time < (nowMillis - isBye.fold(ragequitTimeout, disconnectTimeout).toMillis)
|
||||
} && !userId.??(isPlayingSimul)
|
||||
}
|
||||
|
||||
private val whitePlayer = new Player(White)
|
||||
|
@ -103,22 +102,19 @@ private[round] final class Socket(
|
|||
broom
|
||||
if (timeBomb.boom) self ! PoisonPill
|
||||
else if (!hasAi) Color.all foreach { c =>
|
||||
playerGet(c, _.isGone) foreach { _ ?? notifyGone(c, true) }
|
||||
if (playerGet(c, _.isGone)) notifyGone(c, true)
|
||||
}
|
||||
|
||||
case GetVersion => sender ! history.getVersion
|
||||
|
||||
case IsGone(color) => playerGet(color, _.isGone) pipeTo sender
|
||||
case IsGone(color) => sender ! playerGet(color, _.isGone)
|
||||
|
||||
case GetSocketStatus =>
|
||||
playerGet(White, _.isGone) zip playerGet(Black, _.isGone) map {
|
||||
case (whiteIsGone, blackIsGone) => SocketStatus(
|
||||
version = history.getVersion,
|
||||
whiteOnGame = ownerOf(White).isDefined,
|
||||
whiteIsGone = whiteIsGone,
|
||||
blackOnGame = ownerOf(Black).isDefined,
|
||||
blackIsGone = blackIsGone)
|
||||
} pipeTo sender
|
||||
case GetSocketStatus => sender ! SocketStatus(
|
||||
version = history.getVersion,
|
||||
whiteOnGame = ownerOf(White).isDefined,
|
||||
whiteIsGone = playerGet(White, _.isGone),
|
||||
blackOnGame = ownerOf(Black).isDefined,
|
||||
blackIsGone = playerGet(Black, _.isGone))
|
||||
|
||||
case Join(uid, user, version, color, playerId, ip, userTv) =>
|
||||
val (enumerator, channel) = Concurrent.broadcast[JsValue]
|
||||
|
|
Loading…
Reference in a new issue