Skip to content

Commit

Permalink
refactor: Remove/Fix some compiler warnings (#2899)
Browse files Browse the repository at this point in the history
  • Loading branch information
seakayone authored Oct 24, 2023
1 parent 8418f1f commit cb5dec6
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,36 +20,33 @@ object InstrumentationServer {

private val instrumentationServer =
for {
index <- ZIO.service[IndexApp].map(_.route)
health <- ZIO.service[HealthRouteZ].map(_.route)
prometheus <- ZIO.service[PrometheusApp].map(_.route)
index <- ZIO.serviceWith[IndexApp](_.route)
health <- ZIO.serviceWith[HealthRouteZ](_.route)
prometheus <- ZIO.serviceWith[PrometheusApp](_.route)
app = index ++ health ++ prometheus
_ <- Server.serve(app)
_ <- Server.serve(app).forkDaemon
} yield ()

val make: ZIO[State with AppConfig, Throwable, Fiber.Runtime[Throwable, Unit]] =
ZIO
.service[AppConfig]
.flatMap { config =>
val port = config.instrumentationServerConfig.port
val interval = config.instrumentationServerConfig.interval
val metricsConfig = MetricsConfig(interval)
ZIO.logInfo(s"Starting instrumentation http server on port: $port") *>
instrumentationServer
.provideSome[State](
// HTTP Server
Server.defaultWithPort(port),
// HTTP routes
IndexApp.layer,
HealthRouteZ.layer,
PrometheusApp.layer,
// Metrics dependencies
prometheus.publisherLayer,
ZLayer.succeed(metricsConfig) >>> prometheus.prometheusLayer,
Runtime.enableRuntimeMetrics,
Runtime.enableFiberRoots,
DefaultJvmMetrics.live.unit
)
.forkDaemon
}
val make: ZIO[State with AppConfig, Throwable, Unit] =
ZIO.serviceWithZIO[AppConfig] { config =>
val port = config.instrumentationServerConfig.port
val interval = config.instrumentationServerConfig.interval
val metricsConfig = MetricsConfig(interval)
ZIO.logInfo(s"Starting instrumentation http server on port: $port") *>
instrumentationServer
.provideSome[State](
// HTTP Server
Server.defaultWithPort(port),
// HTTP routes
IndexApp.layer,
HealthRouteZ.layer,
PrometheusApp.layer,
// Metrics dependencies
prometheus.publisherLayer,
ZLayer.succeed(metricsConfig) >>> prometheus.prometheusLayer,
Runtime.enableRuntimeMetrics,
Runtime.enableFiberRoots,
DefaultJvmMetrics.live.unit
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import org.knora.webapi.slice.admin.domain.service.DspIngestClientMock
import org.knora.webapi.slice.admin.domain.service.ProjectExportServiceStub
import org.knora.webapi.slice.admin.domain.service.ProjectExportStorageServiceLive
import org.knora.webapi.slice.admin.domain.service.ProjectImportServiceLive
import org.knora.webapi.store.triplestore.impl.TriplestoreServiceLive

object ProjectsServiceLiveSpec extends ZIOSpecDefault {

Expand Down Expand Up @@ -62,8 +61,6 @@ object ProjectsServiceLiveSpec extends ZIOSpecDefault {

private def projectServiceLayer(exp: Expectation[ProjectsResponderADM]): ULayer[ProjectADMRestService] =
ZLayer.make[ProjectADMRestService](
TriplestoreServiceLive.layer,
StringFormatter.test,
ProjectsADMRestServiceLive.layer,
exp.toLayer,
org.knora.webapi.slice.common.api.RestPermissionServiceLive.layer,
Expand Down

0 comments on commit cb5dec6

Please sign in to comment.