Skip to content

Commit

Permalink
Merge pull request #397 from lichess-org/code-golf/2
Browse files Browse the repository at this point in the history
Minor code hygiene
  • Loading branch information
lenguyenthanh authored Dec 23, 2024
2 parents ad65d9a + e7774c2 commit 3d7ea31
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion modules/app/src/main/scala/http.middleware.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def MkMiddleware(config: HttpServerConfig)(using LoggerFactory[IO]): Middleware
def verboseLogger =
RequestLogger.httpRoutes[IO](true, true).andThen(ResponseLogger.httpRoutes[IO, Request[IO]](true, true))

val logger =
def logger =
if config.apiLogger then verboseLogger
else ApiErrorLogger.instance(using LoggerFactory[IO].getLogger)

Expand Down
4 changes: 2 additions & 2 deletions modules/app/src/main/scala/service.health.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ import org.typelevel.log4cats.{ Logger, LoggerFactory }

class HealthServiceImpl(esClient: ESClient[IO])(using LoggerFactory[IO]) extends HealthService[IO]:

given logger: Logger[IO] = LoggerFactory[IO].getLogger
given Logger[IO] = LoggerFactory[IO].getLogger

override def healthCheck(): IO[HealthCheckOutput] =
esClient.status
.flatMap(transform)
.map(HealthCheckOutput(_))
.handleErrorWith: e =>
logger.error(e)("Error in health check") *>
Logger[IO].error(e)("Error in health check") *>
IO.raiseError(InternalServerError(s"Internal server error $e"))

private def transform(status: String): IO[ElasticStatus] =
Expand Down
2 changes: 1 addition & 1 deletion modules/app/src/main/scala/service.search.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class SearchServiceImpl(esClient: ESClient[IO], metric: Histogram[IO, Double])(u

import SearchServiceImpl.{ *, given }

given logger: Logger[IO] = LoggerFactory[IO].getLogger
private val logger: Logger[IO] = LoggerFactory[IO].getLogger

private val baseAttributes = Attributes(Attribute("http.request.method", "POST"))
private val countMetric =
Expand Down
4 changes: 2 additions & 2 deletions smithy-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
"version": "1.0",
"maven": {
"dependencies": [
"com.disneystreaming.smithy4s:smithy4s-protocol:0.18.15",
"com.disneystreaming.smithy4s:smithy4s-protocol:0.18.27",
"com.disneystreaming.alloy:alloy-core:0.3.4"
],
"repositories": []
},
"imports": [
"./src",
"modules/smithy/src/main/smithy",
"modules/smithy/target/scala-3.5.0/src_managed/main/smithy"
"modules/smithy/target/scala-3.5.2/src_managed/main/smithy"
]
}

0 comments on commit 3d7ea31

Please sign in to comment.