Remove store dependency from scheduler api

This commit is contained in:
eikek
2022-03-13 14:25:09 +01:00
parent 3a05dc56cb
commit 90e52efbff
51 changed files with 614 additions and 482 deletions

View File

@ -13,7 +13,7 @@ import docspell.store.records.RJob
class ContextImpl[F[_]: Functor, A](
val args: A,
val logger: Logger[F],
val store: Store[F],
store: Store[F],
val config: SchedulerConfig,
val jobId: Ident
) extends Context[F, A] {

View File

@ -64,8 +64,23 @@ final class SchedulerImpl[F[_]: Async](
.drain
)
def getRunning: F[Vector[RJob]] =
state.get.flatMap(s => QJob.findAll(s.getRunning, store))
def getRunning: F[Vector[Job[String]]] =
state.get
.flatMap(s => QJob.findAll(s.getRunning, store))
.map(
_.map(rj =>
Job(
rj.id,
rj.task,
rj.group,
rj.args,
rj.subject,
rj.submitter,
rj.priority,
rj.tracker
)
)
)
def requestCancel(jobId: Ident): F[Boolean] =
logger.info(s"Scheduler requested to cancel job: ${jobId.id}") *>