mirror of
https://github.com/TheAnachronism/docspell.git
synced 2025-06-22 02:18:26 +00:00
Make publish async, replace joexclient in periodic job scheduler
This commit is contained in:
@ -32,7 +32,6 @@ import docspell.joex.process.ReProcessItem
|
||||
import docspell.joex.scanmailbox._
|
||||
import docspell.joex.scheduler._
|
||||
import docspell.joex.updatecheck._
|
||||
import docspell.joexapi.client.JoexClient
|
||||
import docspell.pubsub.api.{PubSub, PubSubT}
|
||||
import docspell.store.Store
|
||||
import docspell.store.queue._
|
||||
@ -127,7 +126,6 @@ object JoexAppImpl {
|
||||
): Resource[F, JoexApp[F]] =
|
||||
for {
|
||||
pstore <- PeriodicTaskStore.create(store)
|
||||
client = JoexClient(httpClient)
|
||||
pubSubT = PubSubT(
|
||||
pubSub,
|
||||
Logger.log4s(org.log4s.getLogger(s"joex-${cfg.appId.id}"))
|
||||
@ -271,7 +269,7 @@ object JoexAppImpl {
|
||||
sch,
|
||||
queue,
|
||||
pstore,
|
||||
client
|
||||
joex
|
||||
)
|
||||
app = new JoexAppImpl(cfg, store, queue, pubSubT, pstore, termSignal, sch, psch)
|
||||
appR <- Resource.make(app.init.map(_ => app))(_.initShutdown)
|
||||
|
@ -10,7 +10,7 @@ import cats.effect._
|
||||
import fs2._
|
||||
import fs2.concurrent.SignallingRef
|
||||
|
||||
import docspell.joexapi.client.JoexClient
|
||||
import docspell.backend.ops.OJoex
|
||||
import docspell.store.queue._
|
||||
|
||||
/** A periodic scheduler takes care to submit periodic tasks to the job queue.
|
||||
@ -40,7 +40,7 @@ object PeriodicScheduler {
|
||||
sch: Scheduler[F],
|
||||
queue: JobQueue[F],
|
||||
store: PeriodicTaskStore[F],
|
||||
client: JoexClient[F]
|
||||
joex: OJoex[F]
|
||||
): Resource[F, PeriodicScheduler[F]] =
|
||||
for {
|
||||
waiter <- Resource.eval(SignallingRef(true))
|
||||
@ -50,7 +50,7 @@ object PeriodicScheduler {
|
||||
sch,
|
||||
queue,
|
||||
store,
|
||||
client,
|
||||
joex,
|
||||
waiter,
|
||||
state
|
||||
)
|
||||
|
@ -11,10 +11,10 @@ import cats.implicits._
|
||||
import fs2._
|
||||
import fs2.concurrent.SignallingRef
|
||||
|
||||
import docspell.backend.ops.OJoex
|
||||
import docspell.common._
|
||||
import docspell.common.syntax.all._
|
||||
import docspell.joex.scheduler.PeriodicSchedulerImpl.State
|
||||
import docspell.joexapi.client.JoexClient
|
||||
import docspell.store.queue._
|
||||
import docspell.store.records.RPeriodicTask
|
||||
|
||||
@ -26,7 +26,7 @@ final class PeriodicSchedulerImpl[F[_]: Async](
|
||||
sch: Scheduler[F],
|
||||
queue: JobQueue[F],
|
||||
store: PeriodicTaskStore[F],
|
||||
client: JoexClient[F],
|
||||
joex: OJoex[F],
|
||||
waiter: SignallingRef[F, Boolean],
|
||||
state: SignallingRef[F, State[F]]
|
||||
) extends PeriodicScheduler[F] {
|
||||
@ -119,9 +119,7 @@ final class PeriodicSchedulerImpl[F[_]: Async](
|
||||
}
|
||||
|
||||
def notifyJoex: F[Unit] =
|
||||
sch.notifyChange *> store.findJoexNodes.flatMap(
|
||||
_.traverse(n => client.notifyJoexIgnoreErrors(n.url)).map(_ => ())
|
||||
)
|
||||
sch.notifyChange *> joex.notifyAllNodes
|
||||
|
||||
def scheduleNotify(pj: RPeriodicTask): F[Unit] =
|
||||
Timestamp
|
||||
|
Reference in New Issue
Block a user