Skip to content

Commit

Permalink
Merge pull request #646 from scala-steward/update/scalafmt-core-3.8.5
Browse files Browse the repository at this point in the history
Update scalafmt-core to 3.8.5
  • Loading branch information
ornicar authored Jan 23, 2025
2 parents 49b3a7d + 2f00987 commit a0d4bcf
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ b98d6a989a0e1e1704f690b5baff6285f764c60e

# Apply scalafix rules
bb9fb1481918969cab254a8532243fdf3436e4e8

# Scala Steward: Reformat with scalafmt 3.8.5
dcff3226d2e357b4a4da428c49b3bbeda7ef5125
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.8.3"
version = "3.8.5"
runner.dialect = scala3

align.preset = more
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/Inquirers.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import org.apache.pekko.actor.typed.Scheduler
final class Inquirers(mongo: Mongo)(using ec: Executor, scheduler: Scheduler):

private val cache = Scaffeine()
.expireAfterWrite(5 minutes)
.expireAfterWrite(5.minutes)
.build[User.Id, Boolean]()

def contains(user: User.Id): Boolean =
cache.underlying.getIfPresent(user) == true

scheduler.scheduleAtFixedRate(10 seconds, 2 seconds) { () =>
scheduler.scheduleAtFixedRate(10.seconds, 2.seconds) { () =>
mongo.inquirers.foreach { users =>
cache.putAll(users.view.map(_ -> true).toMap)
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/Lag.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class Lag(lilaRedis: Lila, groupedWithin: util.GroupedWithin):
private val trustedRefreshFactor = 0.1f

private val trustedStats: Cache[User.Id, TrustedMillis] = Scaffeine()
.expireAfterWrite(1 hour)
.expireAfterWrite(1.hour)
.build[User.Id, TrustedMillis]()

export trustedStats.getIfPresent as sessionLag
Expand Down
3 changes: 1 addition & 2 deletions src/main/scala/Lila.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,7 @@ final class Lila(config: Config)(using Executor):
case r: RoundRobinChan =>
connectAndSubscribe(r.out, r.out).zip(Future.sequence:
(0 to r.parallelism).map: index =>
connectAndSubscribe(s"${r.out}:$index", r.out)
)
connectAndSubscribe(s"${r.out}:$index", r.out))
.map: _ =>
val msg = LilaIn.WsBoot.write
connIn.async.publish(chan.in(msg), msg)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/Monitor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ final class Monitor(

scheduler.scheduleWithFixedDelay(5.seconds, 1949.millis) { () => periodicMetrics() }

scheduler.scheduleWithFixedDelay(1 minute, 1 minute) { () => jvmThreads() }
scheduler.scheduleWithFixedDelay(1.minute, 1.minute) { () => jvmThreads() }

private def periodicMetrics() =
val members = LilaWsServer.connections.get
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/Tv.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ object Tv:
Bus.publish(_.room(RoomId(gameId)), cliMsg)
}
(if out.speed <= chess.Speed.Bullet then fast else slow).put(out.gameId.value, true)
Bus.publish(_ tvChannels, cliMsg)
Bus.publish(_.tvChannels, cliMsg)

def get(gameId: Game.Id): Boolean = get(gameId, fast) || get(gameId, slow)

Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/evalCache/EvalCacheApi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ final class EvalCacheApi(mongo: Mongo)(using Executor, Scheduler):

private val cache: AsyncLoadingCache[Id, Option[EvalCacheEntry]] = Scaffeine()
.initialCapacity(65_536)
.expireAfterWrite(5 minutes)
.expireAfterWrite(5.minutes)
.buildAsyncFuture(fetchAndSetAccess)

export cache.get as getEntry
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/evalCache/EvalCacheMulti.scala
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ private object EvalCacheMulti:
private val upgradeMon = Monitor.evalCache.multi.upgrade

def withMonitoring()(using ec: Executor, scheduler: Scheduler): EvalCacheMulti =
val instance = EvalCacheMulti(expire => ExpireCallbackMemo[Sri](1 minute, expire))
scheduler.scheduleWithFixedDelay(1 minute, 1 minute): () =>
val instance = EvalCacheMulti(expire => ExpireCallbackMemo[Sri](1.minute, expire))
scheduler.scheduleWithFixedDelay(1.minute, 1.minute): () =>
upgradeMon.members.update(instance.members.size())
upgradeMon.evals.update(instance.evals.size())
upgradeMon.expirable.update(instance.expirableSris.count)
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/evalCache/EvalCacheUpgrade.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ final private class EvalCacheUpgrade(using ec: Executor, scheduler: Scheduler):

private val members = scalalib.ConcurrentMap[SriString, WatchingMember](4096)
private val evals = scalalib.ConcurrentMap[SetupId, EvalState](1024)
private val expirableSris = ExpireCallbackMemo[Sri](3 minutes, expire)
private val expirableSris = ExpireCallbackMemo[Sri](3.minutes, expire)

private val debouncer = DebouncerFunction[SetupId](scheduler.scheduleOnce(5.seconds, _), 64)

Expand Down Expand Up @@ -69,7 +69,7 @@ final private class EvalCacheUpgrade(using ec: Executor, scheduler: Scheduler):
val newSris = eval.sris - sri
Option.unless(newSris.isEmpty)(eval.copy(sris = newSris))

scheduler.scheduleWithFixedDelay(1 minute, 1 minute): () =>
scheduler.scheduleWithFixedDelay(1.minute, 1.minute): () =>
upgradeMon.members.update(members.size())
upgradeMon.evals.update(evals.size())
upgradeMon.expirable.update(expirableSris.count)
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/netty/ActorChannelConnector.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final private class ActorChannelConnector(
val interval = int("netty.flush.interval-millis")
val maxDelay = int("netty.flush.max-delay-millis")
inline def isFlushQEnabled() = interval.get() > 0
scheduler.scheduleWithFixedDelay(1 minute, 1 minute): () =>
scheduler.scheduleWithFixedDelay(1.minute, 1.minute): () =>
monitor.config.step.update(step.get())
monitor.config.interval.update(interval.get())
monitor.config.maxDelay.update(maxDelay.get())
Expand Down

0 comments on commit a0d4bcf

Please sign in to comment.