Skip to content

Commit

Permalink
fix duplicate tasks being inserted when rebooting
Browse files Browse the repository at this point in the history
  • Loading branch information
Tibor Casteleijn committed Dec 30, 2024
1 parent 3879708 commit c10c3eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions modules/joex/src/main/scala/docspell/joex/JoexAppImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ final class JoexAppImpl[F[_]: Async](
private def scheduleBackgroundTasks: F[Unit] =
HouseKeepingTask
.periodicTask[F](cfg.houseKeeping.schedule)
.flatMap(t => uts.updateTask(UserTaskScope.system, t.summary, t)) *>
.flatMap(t => uts.updateOneTask(UserTaskScope.system, t.summary, t)) *>
scheduleEmptyTrashTasks *>
UpdateCheckTask
.periodicTask(cfg.updateCheck)
.flatMap(t => uts.updateTask(UserTaskScope.system, t.summary, t)) *>
.flatMap(t => uts.updateOneTask(UserTaskScope.system, t.summary, t)) *>
MigrationTask.job.flatMap(jobStore.insertIfNew) *>
AllPreviewsTask
.job(MakePreviewArgs.StoreMode.WhenMissing, None)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import emil._

object UpdateCheckTask {
val taskName: Ident = Ident.unsafe("new-release-check")
val periodicId: Ident = Ident.unsafe("docspell-update-check")

type Args = Unit

Expand All @@ -28,7 +29,7 @@ object UpdateCheckTask {

def periodicTask[F[_]: Sync](cfg: UpdateCheckConfig): F[UserTask[Unit]] =
UserTask(
Ident.unsafe("docspell-update-check"),
periodicId,
taskName,
cfg.enabled,
cfg.schedule,
Expand Down

0 comments on commit c10c3eb

Please sign in to comment.