job-dsl-plugin
job-dsl-plugin copied to clipboard
Fix problem with running the DSL in multiple threads
We use GPars eachParallel() to split up generation of jobs into multiple threads. This significantly reduced our run time from 25min to 5min.
Unfortunately, it leads to a race condition, which causes random jobs to be lost (and deleted) on each run.
Ultimately, it all boils down to this non thread-safe statement in JobParent.processItem(): referencedJobs << job
Making the 5 collections asSynchronized() fixed the problem for us.