mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Move job queue to scheduler-api and fix notification of periodic tasks
This commit is contained in:
@ -12,7 +12,6 @@ import fs2.concurrent.SignallingRef
|
||||
import docspell.analysis.TextAnalyser
|
||||
import docspell.backend.MailAddressCodec
|
||||
import docspell.backend.fulltext.CreateIndex
|
||||
import docspell.backend.msg.{CancelJob, JobQueuePublish, Topics}
|
||||
import docspell.backend.ops._
|
||||
import docspell.common._
|
||||
import docspell.ftsclient.FtsClient
|
||||
@ -32,13 +31,17 @@ import docspell.joex.process.ItemHandler
|
||||
import docspell.joex.process.ReProcessItem
|
||||
import docspell.joex.scanmailbox._
|
||||
import docspell.scheduler._
|
||||
import docspell.scheduler.impl.{PeriodicSchedulerBuilder, SchedulerBuilder}
|
||||
import docspell.scheduler.impl.{
|
||||
PeriodicSchedulerBuilder,
|
||||
PeriodicTaskStore,
|
||||
SchedulerBuilder
|
||||
}
|
||||
import docspell.joex.updatecheck._
|
||||
import docspell.notification.api.NotificationModule
|
||||
import docspell.notification.impl.NotificationModuleImpl
|
||||
import docspell.pubsub.api.{PubSub, PubSubT}
|
||||
import docspell.scheduler.msg.JobQueuePublish
|
||||
import docspell.store.Store
|
||||
import docspell.store.queue._
|
||||
import docspell.store.records.{REmptyTrashSetting, RJobLog}
|
||||
import docspell.store.usertask.UserTaskScope
|
||||
import docspell.store.usertask.UserTaskStore
|
||||
@ -49,7 +52,6 @@ final class JoexAppImpl[F[_]: Async](
|
||||
cfg: Config,
|
||||
store: Store[F],
|
||||
queue: JobQueue[F],
|
||||
pubSubT: PubSubT[F],
|
||||
pstore: PeriodicTaskStore[F],
|
||||
termSignal: SignallingRef[F, Boolean],
|
||||
notificationMod: NotificationModule[F],
|
||||
@ -67,20 +69,11 @@ final class JoexAppImpl[F[_]: Async](
|
||||
_ <- Async[F].start(eventConsume)
|
||||
_ <- scheduler.periodicAwake
|
||||
_ <- periodicScheduler.periodicAwake
|
||||
_ <- subscriptions
|
||||
_ <- scheduler.startSubscriptions
|
||||
_ <- periodicScheduler.startSubscriptions
|
||||
} yield ()
|
||||
}
|
||||
|
||||
def subscriptions =
|
||||
for {
|
||||
_ <- Async[F].start(pubSubT.subscribeSink(Topics.jobsNotify) { _ =>
|
||||
scheduler.notifyChange
|
||||
})
|
||||
_ <- Async[F].start(pubSubT.subscribeSink(CancelJob.topic) { msg =>
|
||||
scheduler.requestCancel(msg.body.jobId).as(())
|
||||
})
|
||||
} yield ()
|
||||
|
||||
def findLogs(jobId: Ident): F[Vector[RJobLog]] =
|
||||
store.transact(RJobLog.findLogs(jobId))
|
||||
|
||||
@ -300,13 +293,12 @@ object JoexAppImpl extends MailAddressCodec {
|
||||
sch,
|
||||
queue,
|
||||
pstore,
|
||||
joex.notifyAllNodes
|
||||
pubSubT
|
||||
)
|
||||
app = new JoexAppImpl(
|
||||
cfg,
|
||||
store,
|
||||
queue,
|
||||
pubSubT,
|
||||
pstore,
|
||||
termSignal,
|
||||
notificationMod,
|
||||
|
@ -9,13 +9,10 @@ package docspell.joex.pagecount
|
||||
import cats.effect._
|
||||
import cats.implicits._
|
||||
import fs2.{Chunk, Stream}
|
||||
|
||||
import docspell.backend.JobFactory
|
||||
import docspell.backend.ops.OJoex
|
||||
import docspell.common._
|
||||
import docspell.scheduler.Context
|
||||
import docspell.scheduler.Task
|
||||
import docspell.store.queue.JobQueue
|
||||
import docspell.scheduler.{Context, JobQueue, Task}
|
||||
import docspell.store.records.RAttachment
|
||||
import docspell.store.records.RJob
|
||||
|
||||
|
@ -9,11 +9,9 @@ package docspell.joex.pdfconv
|
||||
import cats.effect._
|
||||
import cats.implicits._
|
||||
import fs2.{Chunk, Stream}
|
||||
|
||||
import docspell.backend.ops.OJoex
|
||||
import docspell.common._
|
||||
import docspell.scheduler.{Context, Task}
|
||||
import docspell.store.queue.JobQueue
|
||||
import docspell.scheduler.{Context, JobQueue, Task}
|
||||
import docspell.store.records.RAttachment
|
||||
import docspell.store.records._
|
||||
|
||||
|
@ -9,14 +9,11 @@ package docspell.joex.preview
|
||||
import cats.effect._
|
||||
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.Context
|
||||
import docspell.scheduler.Task
|
||||
import docspell.store.queue.JobQueue
|
||||
import docspell.scheduler.{Context, JobQueue, Task}
|
||||
import docspell.store.records.RAttachment
|
||||
import docspell.store.records.RJob
|
||||
|
||||
|
Reference in New Issue
Block a user