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,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
}