mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-04-05 19:09:32 +00:00
Merge pull request #1134 from eikek/update-http4s
Update http4s to 0.23.6
This commit is contained in:
commit
252741dc64
@ -116,12 +116,11 @@ object BackendApp {
|
||||
|
||||
def apply[F[_]: Async](
|
||||
cfg: Config,
|
||||
connectEC: ExecutionContext,
|
||||
httpClientEc: ExecutionContext
|
||||
connectEC: ExecutionContext
|
||||
)(ftsFactory: Client[F] => Resource[F, FtsClient[F]]): Resource[F, BackendApp[F]] =
|
||||
for {
|
||||
store <- Store.create(cfg.jdbc, cfg.files.chunkSize, connectEC)
|
||||
httpClient <- BlazeClientBuilder[F](httpClientEc).resource
|
||||
httpClient <- BlazeClientBuilder[F].resource
|
||||
ftsClient <- ftsFactory(httpClient)
|
||||
backend <- create(cfg, store, httpClient, ftsClient)
|
||||
} yield backend
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
package docspell.backend.ops
|
||||
|
||||
import scala.concurrent.ExecutionContext
|
||||
|
||||
import cats.data.OptionT
|
||||
import cats.effect._
|
||||
import cats.implicits._
|
||||
@ -42,10 +40,7 @@ object OJoex {
|
||||
} yield cancel.success).getOrElse(false)
|
||||
})
|
||||
|
||||
def create[F[_]: Async](
|
||||
ec: ExecutionContext,
|
||||
store: Store[F]
|
||||
): Resource[F, OJoex[F]] =
|
||||
JoexClient.resource(ec).flatMap(client => apply(client, store))
|
||||
def create[F[_]: Async](store: Store[F]): Resource[F, OJoex[F]] =
|
||||
JoexClient.resource.flatMap(client => apply(client, store))
|
||||
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ import scala.concurrent.ExecutionContext
|
||||
|
||||
/** Captures thread pools to use in an application. */
|
||||
case class Pools(
|
||||
connectEC: ExecutionContext,
|
||||
httpClientEC: ExecutionContext,
|
||||
restEC: ExecutionContext
|
||||
connectEC: ExecutionContext
|
||||
// httpClientEC: ExecutionContext,
|
||||
// restEC: ExecutionContext
|
||||
)
|
||||
|
@ -116,11 +116,10 @@ object JoexAppImpl {
|
||||
def create[F[_]: Async](
|
||||
cfg: Config,
|
||||
termSignal: SignallingRef[F, Boolean],
|
||||
connectEC: ExecutionContext,
|
||||
clientEC: ExecutionContext
|
||||
connectEC: ExecutionContext
|
||||
): Resource[F, JoexApp[F]] =
|
||||
for {
|
||||
httpClient <- BlazeClientBuilder[F](clientEC).resource
|
||||
httpClient <- BlazeClientBuilder[F].resource
|
||||
client = JoexClient(httpClient)
|
||||
store <- Store.create(cfg.jdbc, cfg.files.chunkSize, connectEC)
|
||||
queue <- JobQueue(store)
|
||||
|
@ -33,9 +33,7 @@ object JoexServer {
|
||||
val app = for {
|
||||
signal <- Resource.eval(SignallingRef[F, Boolean](false))
|
||||
exitCode <- Resource.eval(Ref[F].of(ExitCode.Success))
|
||||
joexApp <-
|
||||
JoexAppImpl
|
||||
.create[F](cfg, signal, pools.connectEC, pools.httpClientEC)
|
||||
joexApp <- JoexAppImpl.create[F](cfg, signal, pools.connectEC)
|
||||
|
||||
httpApp = Router(
|
||||
"/api/info" -> InfoRoutes(cfg),
|
||||
@ -50,7 +48,7 @@ object JoexServer {
|
||||
Stream
|
||||
.resource(app)
|
||||
.flatMap(app =>
|
||||
BlazeServerBuilder[F](pools.restEC)
|
||||
BlazeServerBuilder[F]
|
||||
.bindHttp(cfg.bind.port, cfg.bind.address)
|
||||
.withHttpApp(app.httpApp)
|
||||
.withoutBanner
|
||||
|
@ -60,11 +60,7 @@ object Main extends IOApp {
|
||||
logger.warn(">>>>> Docspell is running in DEV mode! <<<<<")
|
||||
}
|
||||
|
||||
val pools = for {
|
||||
cec <- connectEC
|
||||
bec <- blockingEC
|
||||
rec <- restserverEC
|
||||
} yield Pools(cec, bec, rec)
|
||||
val pools = connectEC.map(Pools.apply)
|
||||
pools.use(p =>
|
||||
JoexServer
|
||||
.stream[IO](cfg, p)
|
||||
|
@ -26,7 +26,7 @@ object CheckNodesTask {
|
||||
for {
|
||||
_ <- ctx.logger.info("Check nodes reachability")
|
||||
ec = scala.concurrent.ExecutionContext.global
|
||||
_ <- BlazeClientBuilder[F](ec).resource.use { client =>
|
||||
_ <- BlazeClientBuilder[F].withExecutionContext(ec).resource.use { client =>
|
||||
checkNodes(ctx, client)
|
||||
}
|
||||
_ <- ctx.logger.info(
|
||||
|
@ -6,8 +6,6 @@
|
||||
|
||||
package docspell.joexapi.client
|
||||
|
||||
import scala.concurrent.ExecutionContext
|
||||
|
||||
import cats.effect._
|
||||
import cats.implicits._
|
||||
|
||||
@ -69,6 +67,6 @@ object JoexClient {
|
||||
Uri.unsafeFromString(u.asString)
|
||||
}
|
||||
|
||||
def resource[F[_]: Async](ec: ExecutionContext): Resource[F, JoexClient[F]] =
|
||||
BlazeClientBuilder[F](ec).resource.map(apply[F])
|
||||
def resource[F[_]: Async]: Resource[F, JoexClient[F]] =
|
||||
BlazeClientBuilder[F].resource.map(apply[F])
|
||||
}
|
||||
|
@ -55,12 +55,7 @@ object Main extends IOApp {
|
||||
cfg.baseUrl,
|
||||
Some(cfg.fullTextSearch.solr.url).filter(_ => cfg.fullTextSearch.enabled)
|
||||
)
|
||||
val pools = for {
|
||||
cec <- connectEC
|
||||
bec <- blockingEC
|
||||
rec <- restserverEC
|
||||
} yield Pools(cec, bec, rec)
|
||||
|
||||
val pools = connectEC.map(Pools.apply)
|
||||
logger.info(s"\n${banner.render("***>")}")
|
||||
if (EnvMode.current.isDev) {
|
||||
logger.warn(">>>>> Docspell is running in DEV mode! <<<<<")
|
||||
|
@ -32,11 +32,10 @@ object RestAppImpl {
|
||||
|
||||
def create[F[_]: Async](
|
||||
cfg: Config,
|
||||
connectEC: ExecutionContext,
|
||||
httpClientEc: ExecutionContext
|
||||
connectEC: ExecutionContext
|
||||
): Resource[F, RestApp[F]] =
|
||||
for {
|
||||
backend <- BackendApp(cfg.backend, connectEC, httpClientEc)(
|
||||
backend <- BackendApp(cfg.backend, connectEC)(
|
||||
createFtsClient[F](cfg)
|
||||
)
|
||||
app = new RestAppImpl[F](cfg, backend)
|
||||
|
@ -34,10 +34,8 @@ object RestServer {
|
||||
|
||||
val templates = TemplateRoutes[F](cfg)
|
||||
val app = for {
|
||||
restApp <-
|
||||
RestAppImpl
|
||||
.create[F](cfg, pools.connectEC, pools.httpClientEC)
|
||||
httpClient <- BlazeClientBuilder[F](pools.httpClientEC).resource
|
||||
restApp <- RestAppImpl.create[F](cfg, pools.connectEC)
|
||||
httpClient <- BlazeClientBuilder[F].resource
|
||||
httpApp = Router(
|
||||
"/api/info" -> routes.InfoRoutes(),
|
||||
"/api/v1/open/" -> openRoutes(cfg, httpClient, restApp),
|
||||
@ -64,7 +62,7 @@ object RestServer {
|
||||
Stream
|
||||
.resource(app)
|
||||
.flatMap(httpApp =>
|
||||
BlazeServerBuilder[F](pools.restEC)
|
||||
BlazeServerBuilder[F]
|
||||
.bindHttp(cfg.bind.port, cfg.bind.address)
|
||||
.withHttpApp(httpApp)
|
||||
.withoutBanner
|
||||
|
@ -19,7 +19,7 @@ object Dependencies {
|
||||
val Fs2Version = "3.1.6"
|
||||
val Fs2CronVersion = "0.7.1"
|
||||
val H2Version = "1.4.200"
|
||||
val Http4sVersion = "0.23.4"
|
||||
val Http4sVersion = "0.23.6"
|
||||
val Icu4jVersion = "69.1"
|
||||
val javaOtpVersion = "0.3.0"
|
||||
val JsoupVersion = "1.14.3"
|
||||
|
Loading…
x
Reference in New Issue
Block a user