Merge pull request #1134 from eikek/update-http4s

Update http4s to 0.23.6
This commit is contained in:
mergify[bot] 2021-10-24 16:37:26 +00:00 committed by GitHub
commit 252741dc64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 22 additions and 45 deletions

View File

@ -116,12 +116,11 @@ object BackendApp {
def apply[F[_]: Async]( def apply[F[_]: Async](
cfg: Config, cfg: Config,
connectEC: ExecutionContext, connectEC: ExecutionContext
httpClientEc: ExecutionContext
)(ftsFactory: Client[F] => Resource[F, FtsClient[F]]): Resource[F, BackendApp[F]] = )(ftsFactory: Client[F] => Resource[F, FtsClient[F]]): Resource[F, BackendApp[F]] =
for { for {
store <- Store.create(cfg.jdbc, cfg.files.chunkSize, connectEC) store <- Store.create(cfg.jdbc, cfg.files.chunkSize, connectEC)
httpClient <- BlazeClientBuilder[F](httpClientEc).resource httpClient <- BlazeClientBuilder[F].resource
ftsClient <- ftsFactory(httpClient) ftsClient <- ftsFactory(httpClient)
backend <- create(cfg, store, httpClient, ftsClient) backend <- create(cfg, store, httpClient, ftsClient)
} yield backend } yield backend

View File

@ -6,8 +6,6 @@
package docspell.backend.ops package docspell.backend.ops
import scala.concurrent.ExecutionContext
import cats.data.OptionT import cats.data.OptionT
import cats.effect._ import cats.effect._
import cats.implicits._ import cats.implicits._
@ -42,10 +40,7 @@ object OJoex {
} yield cancel.success).getOrElse(false) } yield cancel.success).getOrElse(false)
}) })
def create[F[_]: Async]( def create[F[_]: Async](store: Store[F]): Resource[F, OJoex[F]] =
ec: ExecutionContext, JoexClient.resource.flatMap(client => apply(client, store))
store: Store[F]
): Resource[F, OJoex[F]] =
JoexClient.resource(ec).flatMap(client => apply(client, store))
} }

View File

@ -10,7 +10,7 @@ import scala.concurrent.ExecutionContext
/** Captures thread pools to use in an application. */ /** Captures thread pools to use in an application. */
case class Pools( case class Pools(
connectEC: ExecutionContext, connectEC: ExecutionContext
httpClientEC: ExecutionContext, // httpClientEC: ExecutionContext,
restEC: ExecutionContext // restEC: ExecutionContext
) )

View File

@ -116,11 +116,10 @@ object JoexAppImpl {
def create[F[_]: Async]( def create[F[_]: Async](
cfg: Config, cfg: Config,
termSignal: SignallingRef[F, Boolean], termSignal: SignallingRef[F, Boolean],
connectEC: ExecutionContext, connectEC: ExecutionContext
clientEC: ExecutionContext
): Resource[F, JoexApp[F]] = ): Resource[F, JoexApp[F]] =
for { for {
httpClient <- BlazeClientBuilder[F](clientEC).resource httpClient <- BlazeClientBuilder[F].resource
client = JoexClient(httpClient) client = JoexClient(httpClient)
store <- Store.create(cfg.jdbc, cfg.files.chunkSize, connectEC) store <- Store.create(cfg.jdbc, cfg.files.chunkSize, connectEC)
queue <- JobQueue(store) queue <- JobQueue(store)

View File

@ -33,9 +33,7 @@ object JoexServer {
val app = for { val app = for {
signal <- Resource.eval(SignallingRef[F, Boolean](false)) signal <- Resource.eval(SignallingRef[F, Boolean](false))
exitCode <- Resource.eval(Ref[F].of(ExitCode.Success)) exitCode <- Resource.eval(Ref[F].of(ExitCode.Success))
joexApp <- joexApp <- JoexAppImpl.create[F](cfg, signal, pools.connectEC)
JoexAppImpl
.create[F](cfg, signal, pools.connectEC, pools.httpClientEC)
httpApp = Router( httpApp = Router(
"/api/info" -> InfoRoutes(cfg), "/api/info" -> InfoRoutes(cfg),
@ -50,7 +48,7 @@ object JoexServer {
Stream Stream
.resource(app) .resource(app)
.flatMap(app => .flatMap(app =>
BlazeServerBuilder[F](pools.restEC) BlazeServerBuilder[F]
.bindHttp(cfg.bind.port, cfg.bind.address) .bindHttp(cfg.bind.port, cfg.bind.address)
.withHttpApp(app.httpApp) .withHttpApp(app.httpApp)
.withoutBanner .withoutBanner

View File

@ -60,11 +60,7 @@ object Main extends IOApp {
logger.warn(">>>>> Docspell is running in DEV mode! <<<<<") logger.warn(">>>>> Docspell is running in DEV mode! <<<<<")
} }
val pools = for { val pools = connectEC.map(Pools.apply)
cec <- connectEC
bec <- blockingEC
rec <- restserverEC
} yield Pools(cec, bec, rec)
pools.use(p => pools.use(p =>
JoexServer JoexServer
.stream[IO](cfg, p) .stream[IO](cfg, p)

View File

@ -26,7 +26,7 @@ object CheckNodesTask {
for { for {
_ <- ctx.logger.info("Check nodes reachability") _ <- ctx.logger.info("Check nodes reachability")
ec = scala.concurrent.ExecutionContext.global ec = scala.concurrent.ExecutionContext.global
_ <- BlazeClientBuilder[F](ec).resource.use { client => _ <- BlazeClientBuilder[F].withExecutionContext(ec).resource.use { client =>
checkNodes(ctx, client) checkNodes(ctx, client)
} }
_ <- ctx.logger.info( _ <- ctx.logger.info(

View File

@ -6,8 +6,6 @@
package docspell.joexapi.client package docspell.joexapi.client
import scala.concurrent.ExecutionContext
import cats.effect._ import cats.effect._
import cats.implicits._ import cats.implicits._
@ -69,6 +67,6 @@ object JoexClient {
Uri.unsafeFromString(u.asString) Uri.unsafeFromString(u.asString)
} }
def resource[F[_]: Async](ec: ExecutionContext): Resource[F, JoexClient[F]] = def resource[F[_]: Async]: Resource[F, JoexClient[F]] =
BlazeClientBuilder[F](ec).resource.map(apply[F]) BlazeClientBuilder[F].resource.map(apply[F])
} }

View File

@ -55,12 +55,7 @@ object Main extends IOApp {
cfg.baseUrl, cfg.baseUrl,
Some(cfg.fullTextSearch.solr.url).filter(_ => cfg.fullTextSearch.enabled) Some(cfg.fullTextSearch.solr.url).filter(_ => cfg.fullTextSearch.enabled)
) )
val pools = for { val pools = connectEC.map(Pools.apply)
cec <- connectEC
bec <- blockingEC
rec <- restserverEC
} yield Pools(cec, bec, rec)
logger.info(s"\n${banner.render("***>")}") logger.info(s"\n${banner.render("***>")}")
if (EnvMode.current.isDev) { if (EnvMode.current.isDev) {
logger.warn(">>>>> Docspell is running in DEV mode! <<<<<") logger.warn(">>>>> Docspell is running in DEV mode! <<<<<")

View File

@ -32,11 +32,10 @@ object RestAppImpl {
def create[F[_]: Async]( def create[F[_]: Async](
cfg: Config, cfg: Config,
connectEC: ExecutionContext, connectEC: ExecutionContext
httpClientEc: ExecutionContext
): Resource[F, RestApp[F]] = ): Resource[F, RestApp[F]] =
for { for {
backend <- BackendApp(cfg.backend, connectEC, httpClientEc)( backend <- BackendApp(cfg.backend, connectEC)(
createFtsClient[F](cfg) createFtsClient[F](cfg)
) )
app = new RestAppImpl[F](cfg, backend) app = new RestAppImpl[F](cfg, backend)

View File

@ -34,10 +34,8 @@ object RestServer {
val templates = TemplateRoutes[F](cfg) val templates = TemplateRoutes[F](cfg)
val app = for { val app = for {
restApp <- restApp <- RestAppImpl.create[F](cfg, pools.connectEC)
RestAppImpl httpClient <- BlazeClientBuilder[F].resource
.create[F](cfg, pools.connectEC, pools.httpClientEC)
httpClient <- BlazeClientBuilder[F](pools.httpClientEC).resource
httpApp = Router( httpApp = Router(
"/api/info" -> routes.InfoRoutes(), "/api/info" -> routes.InfoRoutes(),
"/api/v1/open/" -> openRoutes(cfg, httpClient, restApp), "/api/v1/open/" -> openRoutes(cfg, httpClient, restApp),
@ -64,7 +62,7 @@ object RestServer {
Stream Stream
.resource(app) .resource(app)
.flatMap(httpApp => .flatMap(httpApp =>
BlazeServerBuilder[F](pools.restEC) BlazeServerBuilder[F]
.bindHttp(cfg.bind.port, cfg.bind.address) .bindHttp(cfg.bind.port, cfg.bind.address)
.withHttpApp(httpApp) .withHttpApp(httpApp)
.withoutBanner .withoutBanner

View File

@ -19,7 +19,7 @@ object Dependencies {
val Fs2Version = "3.1.6" val Fs2Version = "3.1.6"
val Fs2CronVersion = "0.7.1" val Fs2CronVersion = "0.7.1"
val H2Version = "1.4.200" val H2Version = "1.4.200"
val Http4sVersion = "0.23.4" val Http4sVersion = "0.23.6"
val Icu4jVersion = "69.1" val Icu4jVersion = "69.1"
val javaOtpVersion = "0.3.0" val javaOtpVersion = "0.3.0"
val JsoupVersion = "1.14.3" val JsoupVersion = "1.14.3"