The id must be recreated for each job, obviously

Fixes: #938
This commit is contained in:
eikek 2021-07-16 21:14:47 +02:00
parent 280968355e
commit 1913877de1

View File

@ -145,7 +145,10 @@ object JobFactory {
prio: Priority, prio: Priority,
tracker: Option[Ident] tracker: Option[Ident]
): F[Vector[RJob]] = { ): F[Vector[RJob]] = {
def create(id: Ident, now: Timestamp, arg: ProcessItemArgs): RJob = def create(now: Timestamp, arg: ProcessItemArgs): F[RJob] =
Ident
.randomId[F]
.map(id =>
RJob.newJob( RJob.newJob(
id, id,
ProcessItemArgs.taskName, ProcessItemArgs.taskName,
@ -157,11 +160,11 @@ object JobFactory {
prio, prio,
tracker tracker
) )
)
for { for {
id <- Ident.randomId[F]
now <- Timestamp.current[F] now <- Timestamp.current[F]
jobs = args.map(a => create(id, now, a)) jobs <- args.traverse(a => create(now, a))
} yield jobs } yield jobs
} }