rename Future.nevermind -> Future.recoverDefault
parent
998c6e8584
commit
655c6aaa4f
|
@ -155,7 +155,7 @@ final class Env(
|
|||
_ <- challenge.api.removeByUserId(u.id)
|
||||
_ <- tournament.api.withdrawAll(u)
|
||||
_ <- swiss.api.withdrawAll(u, teamIds)
|
||||
_ <- plan.api.cancel(u).nevermind
|
||||
_ <- plan.api.cancel(u).recoverDefault
|
||||
_ <- lobby.seekApi.removeByUser(u)
|
||||
_ <- security.store.closeAllSessionsOf(u.id)
|
||||
_ <- push.webSubscriptionApi.unsubscribeByUser(u)
|
||||
|
|
|
@ -20,11 +20,11 @@ final class KeyPages(env: Env)(implicit ec: scala.concurrent.ExecutionContext) {
|
|||
def homeHtml(implicit ctx: Context): Fu[Frag] =
|
||||
env
|
||||
.preloader(
|
||||
posts = env.forum.recent(ctx.me, env.team.cached.teamIdsList).nevermind,
|
||||
tours = env.tournament.cached.onHomepage.getUnit.nevermind,
|
||||
posts = env.forum.recent(ctx.me, env.team.cached.teamIdsList).recoverDefault,
|
||||
tours = env.tournament.cached.onHomepage.getUnit.recoverDefault,
|
||||
swiss = env.swiss.feature.onHomepage.getUnit.getIfPresent,
|
||||
events = env.event.api.promoteTo(ctx.req).nevermind,
|
||||
simuls = env.simul.allCreatedFeaturable.get {}.nevermind,
|
||||
events = env.event.api.promoteTo(ctx.req).recoverDefault,
|
||||
simuls = env.simul.allCreatedFeaturable.get {}.recoverDefault,
|
||||
streamerSpots = env.streamer.homepageMaxSetting.get()
|
||||
)
|
||||
.mon(_.lobby segment "preloader.total")
|
||||
|
|
|
@ -60,7 +60,7 @@ final class Relation(
|
|||
lila.msg.MsgPreset.maxFollow(me.username, env.relation.maxFollow.value)
|
||||
) inject Ok
|
||||
case _ =>
|
||||
api.follow(me.id, UserModel normalize userId).nevermind >> renderActions(userId, getBool("mini"))
|
||||
api.follow(me.id, UserModel normalize userId).recoverDefault >> renderActions(userId, getBool("mini"))
|
||||
}
|
||||
}(rateLimitedFu)
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ final class Relation(
|
|||
Api.ClientError(lila.msg.MsgPreset.maxFollow(me.username, env.relation.maxFollow.value).text)
|
||||
)
|
||||
case _ =>
|
||||
api.follow(me.id, UserModel normalize userId).nevermind inject Api.Done
|
||||
api.follow(me.id, UserModel normalize userId).recoverDefault inject Api.Done
|
||||
}
|
||||
}(fuccess(Api.Limited)) map apiC.toHttp
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ final class Relation(
|
|||
def unfollow(userId: String) =
|
||||
Auth { implicit ctx => me =>
|
||||
FollowLimitPerUser(me.id) {
|
||||
api.unfollow(me.id, UserModel normalize userId).nevermind >> renderActions(userId, getBool("mini"))
|
||||
api.unfollow(me.id, UserModel normalize userId).recoverDefault >> renderActions(userId, getBool("mini"))
|
||||
}(rateLimitedFu)
|
||||
}
|
||||
|
||||
|
@ -96,13 +96,13 @@ final class Relation(
|
|||
def block(userId: String) =
|
||||
Auth { implicit ctx => me =>
|
||||
FollowLimitPerUser(me.id) {
|
||||
api.block(me.id, UserModel normalize userId).nevermind >> renderActions(userId, getBool("mini"))
|
||||
api.block(me.id, UserModel normalize userId).recoverDefault >> renderActions(userId, getBool("mini"))
|
||||
}(rateLimitedFu)
|
||||
}
|
||||
|
||||
def unblock(userId: String) =
|
||||
Auth { implicit ctx => me =>
|
||||
api.unblock(me.id, UserModel normalize userId).nevermind >> renderActions(userId, getBool("mini"))
|
||||
api.unblock(me.id, UserModel normalize userId).recoverDefault >> renderActions(userId, getBool("mini"))
|
||||
}
|
||||
|
||||
def following(username: String, page: Int) =
|
||||
|
|
|
@ -512,7 +512,7 @@ final class Tournament(
|
|||
negotiate(
|
||||
html = notFound,
|
||||
api = _ =>
|
||||
env.tournament.cached.onHomepage.getUnit.nevermind map {
|
||||
env.tournament.cached.onHomepage.getUnit.recoverDefault map {
|
||||
lila.tournament.Spotlight.select(_, ctx.me, 4)
|
||||
} flatMap env.tournament.apiJsonView.featured map { Ok(_) }
|
||||
)
|
||||
|
|
|
@ -132,7 +132,7 @@ object UserInfo {
|
|||
relationApi.countFollowers(user.id).mon(_.user segment "nbFollowers") zip
|
||||
!(user.is(User.lichessId) || user.isBot) ??
|
||||
postApi.nbByUser(user.id).mon(_.user segment "nbPosts") zip
|
||||
studyRepo.countByOwner(user.id).nevermind.mon(_.user segment "nbStudies") zip
|
||||
studyRepo.countByOwner(user.id).recoverDefault.mon(_.user segment "nbStudies") zip
|
||||
trophyApi.findByUser(user).mon(_.user segment "trophy") zip
|
||||
shieldApi.active(user).mon(_.user segment "shields") zip
|
||||
revolutionApi.active(user).mon(_.user segment "revolutions") zip
|
||||
|
|
|
@ -168,14 +168,14 @@ final class PimpedFuture[A](private val fua: Fu[A]) extends AnyVal {
|
|||
def logTime(name: String) = chronometer pp name
|
||||
def logTimeIfGt(name: String, duration: FiniteDuration) = chronometer.ppIfGt(name, duration)
|
||||
|
||||
def nevermind(implicit z: Zero[A], ec: EC): Fu[A] = nevermind(z.zero)
|
||||
def recoverDefault(implicit z: Zero[A], ec: EC): Fu[A] = recoverDefault(z.zero)
|
||||
|
||||
def nevermind(default: => A)(implicit ec: EC): Fu[A] =
|
||||
def recoverDefault(default: => A)(implicit ec: EC): Fu[A] =
|
||||
fua recover {
|
||||
case _: LilaException => default
|
||||
case _: java.util.concurrent.TimeoutException => default
|
||||
case e: Exception =>
|
||||
lila.log("common").warn("Future.nevermind", e)
|
||||
lila.log("common").warn("Future.recoverDefault", e)
|
||||
default
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,7 +68,7 @@ final private class ZulipClient(ws: StandaloneWSClient, config: ZulipClient.Conf
|
|||
}
|
||||
.monSuccess(_.irc.zulip.say(msg.stream))
|
||||
.logFailure(lila.log("zulip"))
|
||||
.nevermind
|
||||
.recoverDefault
|
||||
|
||||
}(fuccess(None))
|
||||
}
|
||||
|
|
|
@ -162,7 +162,7 @@ final class MsgApi(
|
|||
destSource
|
||||
.filter(orig.id !=)
|
||||
.mapAsync(4) {
|
||||
post(orig.id, _, text, multi = true).logFailure(logger).nevermind(PostResult.Invalid)
|
||||
post(orig.id, _, text, multi = true).logFailure(logger).recoverDefault(PostResult.Invalid)
|
||||
}
|
||||
.toMat(LilaStream.sinkCount)(Keep.right)
|
||||
.run()
|
||||
|
|
|
@ -15,7 +15,7 @@ final private class HookThieve()(implicit
|
|||
Bus
|
||||
.ask[PoolHooks]("lobbyTrouper")(GetCandidates(clock, _))
|
||||
.logFailure(logger)
|
||||
.nevermind(PoolHooks(Vector.empty))
|
||||
.recoverDefault(PoolHooks(Vector.empty))
|
||||
|
||||
def stolen(poolHooks: Vector[PoolHook], monId: String) = {
|
||||
lila.mon.lobby.pool.thieve.stolen(monId).record(poolHooks.size)
|
||||
|
|
|
@ -85,7 +85,7 @@ final class PuzzleApi(
|
|||
}
|
||||
}
|
||||
}
|
||||
}.logFailure(logger, _ => s"puzzle.vote $id").nevermind
|
||||
}.logFailure(logger, _ => s"puzzle.vote $id").recoverDefault
|
||||
|
||||
private def updatePuzzle(puzzleId: Puzzle.Id, newVote: Int, prevVote: Option[Int]): Funit =
|
||||
colls.puzzle { coll =>
|
||||
|
|
|
@ -47,7 +47,7 @@ ${trans.common_orPaste.txt()}
|
|||
tokener read token dmap (_.flatten) flatMap {
|
||||
_ ?? { case TokenPayload(userId, email) =>
|
||||
userRepo.email(userId) flatMap { previous =>
|
||||
(userRepo.setEmail(userId, email).nevermind >> userRepo.byId(userId))
|
||||
(userRepo.setEmail(userId, email).recoverDefault >> userRepo.byId(userId))
|
||||
.map2(_ -> previous)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ final class GarbageCollector(
|
|||
retries = 5,
|
||||
logger = none
|
||||
)
|
||||
.nevermind >> apply(applyData)
|
||||
.recoverDefault >> apply(applyData)
|
||||
()
|
||||
}
|
||||
.unit
|
||||
|
|
|
@ -180,7 +180,7 @@ final class RemoteSocket(
|
|||
res => logger.info(s"lila-ws says: $res")
|
||||
).withTimeout(1 second)
|
||||
.addFailureEffect(e => logger.error("lila-ws stop", e))
|
||||
.nevermind
|
||||
.recoverDefault
|
||||
}
|
||||
|
||||
Lilakka.shutdown(shutdown, _.PhaseServiceUnbind, "Stopping the socket redis pool") { () =>
|
||||
|
|
Loading…
Reference in New Issue