Publish joex from within the job store

Reduces friction when using the job store.
This commit is contained in:
eikek
2022-03-20 11:40:44 +01:00
parent b84bbbd750
commit 0b3fe8eb5c
19 changed files with 71 additions and 122 deletions

View File

@ -117,7 +117,7 @@ final class JoexTasks[F[_]: Async](
.withTask(
JobTask.json(
ConvertAllPdfArgs.taskName,
ConvertAllPdfTask[F](jobStoreModule.jobs, joex, store),
ConvertAllPdfTask[F](jobStoreModule.jobs, store),
ConvertAllPdfTask.onCancel[F]
)
)
@ -138,7 +138,7 @@ final class JoexTasks[F[_]: Async](
.withTask(
JobTask.json(
AllPreviewsArgs.taskName,
AllPreviewsTask[F](jobStoreModule.jobs, joex, store),
AllPreviewsTask[F](jobStoreModule.jobs, store),
AllPreviewsTask.onCancel[F]
)
)
@ -152,7 +152,7 @@ final class JoexTasks[F[_]: Async](
.withTask(
JobTask.json(
AllPageCountTask.taskName,
AllPageCountTask[F](store, jobStoreModule.jobs, joex),
AllPageCountTask[F](store, jobStoreModule.jobs),
AllPageCountTask.onCancel[F]
)
)
@ -220,16 +220,16 @@ object JoexTasks {
for {
joex <- OJoex(pubSub)
store = jobStoreModule.store
upload <- OUpload(store, jobStoreModule.jobs, joex)
upload <- OUpload(store, jobStoreModule.jobs)
fts <- createFtsClient(cfg)(httpClient)
createIndex <- CreateIndex.resource(fts, store)
itemOps <- OItem(store, fts, createIndex, jobStoreModule.jobs, joex)
itemOps <- OItem(store, fts, createIndex, jobStoreModule.jobs)
itemSearchOps <- OItemSearch(store)
analyser <- TextAnalyser.create[F](cfg.textAnalysis.textAnalysisConfig)
regexNer <- RegexNerFile(cfg.textAnalysis.regexNerFileConfig, store)
updateCheck <- UpdateCheck.resource(httpClient)
notification <- ONotification(store, notificationModule)
fileRepo <- OFileRepository(store, jobStoreModule.jobs, joex)
fileRepo <- OFileRepository(store, jobStoreModule.jobs)
} yield new JoexTasks[F](
cfg,
store,

View File

@ -11,7 +11,6 @@ import cats.implicits._
import fs2.{Chunk, Stream}
import docspell.backend.JobFactory
import docspell.backend.ops.OJoex
import docspell.common._
import docspell.scheduler._
import docspell.store.Store
@ -24,15 +23,13 @@ object AllPageCountTask {
def apply[F[_]: Sync](
store: Store[F],
jobStore: JobStore[F],
joex: OJoex[F]
jobStore: JobStore[F]
): Task[F, Args, Unit] =
Task { ctx =>
for {
_ <- ctx.logger.info("Generating previews for attachments")
n <- submitConversionJobs(ctx, store, jobStore)
_ <- ctx.logger.info(s"Submitted $n jobs")
_ <- joex.notifyAllNodes
} yield ()
}

View File

@ -10,7 +10,6 @@ import cats.effect._
import cats.implicits._
import fs2.{Chunk, Stream}
import docspell.backend.ops.OJoex
import docspell.common._
import docspell.scheduler._
import docspell.store.Store
@ -25,7 +24,6 @@ object ConvertAllPdfTask {
def apply[F[_]: Sync](
jobStore: JobStore[F],
joex: OJoex[F],
store: Store[F]
): Task[F, Args, Unit] =
Task { ctx =>
@ -33,7 +31,6 @@ object ConvertAllPdfTask {
_ <- ctx.logger.info("Converting pdfs using ocrmypdf")
n <- submitConversionJobs(ctx, store, jobStore)
_ <- ctx.logger.info(s"Submitted $n file conversion jobs")
_ <- joex.notifyAllNodes
} yield ()
}

View File

@ -11,7 +11,6 @@ import cats.implicits._
import fs2.{Chunk, Stream}
import docspell.backend.JobFactory
import docspell.backend.ops.OJoex
import docspell.common.MakePreviewArgs.StoreMode
import docspell.common._
import docspell.scheduler._
@ -24,7 +23,6 @@ object AllPreviewsTask {
def apply[F[_]: Sync](
jobStore: JobStore[F],
joex: OJoex[F],
store: Store[F]
): Task[F, Args, Unit] =
Task { ctx =>
@ -32,7 +30,6 @@ object AllPreviewsTask {
_ <- ctx.logger.info("Generating previews for attachments")
n <- submitConversionJobs(ctx, store, jobStore)
_ <- ctx.logger.info(s"Submitted $n jobs")
_ <- joex.notifyAllNodes
} yield ()
}

View File

@ -337,7 +337,7 @@ object ScanMailboxTask {
priority = Priority.Low,
tracker = None
)
res <- upload.submit(data, ctx.args.account, false, None)
res <- upload.submit(data, ctx.args.account, None)
} yield res
}