From 1913877de11c60d7e83b3f5e4fc02fbbf8e09137 Mon Sep 17 00:00:00 2001 From: eikek Date: Fri, 16 Jul 2021 21:14:47 +0200 Subject: [PATCH] The id must be recreated for each job, obviously Fixes: #938 --- .../scala/docspell/backend/JobFactory.scala | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/modules/backend/src/main/scala/docspell/backend/JobFactory.scala b/modules/backend/src/main/scala/docspell/backend/JobFactory.scala index 19fa46df..e1d11a9d 100644 --- a/modules/backend/src/main/scala/docspell/backend/JobFactory.scala +++ b/modules/backend/src/main/scala/docspell/backend/JobFactory.scala @@ -145,23 +145,26 @@ object JobFactory { prio: Priority, tracker: Option[Ident] ): F[Vector[RJob]] = { - def create(id: Ident, now: Timestamp, arg: ProcessItemArgs): RJob = - RJob.newJob( - id, - ProcessItemArgs.taskName, - account.collective, - arg, - arg.makeSubject, - now, - account.user, - prio, - tracker - ) + def create(now: Timestamp, arg: ProcessItemArgs): F[RJob] = + Ident + .randomId[F] + .map(id => + RJob.newJob( + id, + ProcessItemArgs.taskName, + account.collective, + arg, + arg.makeSubject, + now, + account.user, + prio, + tracker + ) + ) for { - id <- Ident.randomId[F] - now <- Timestamp.current[F] - jobs = args.map(a => create(id, now, a)) + now <- Timestamp.current[F] + jobs <- args.traverse(a => create(now, a)) } yield jobs }