Ideally finished jobs would transition into the NeedsReport state upon completion to make room for the next job to start.
Currently
-
Only one job can be in the GeneratingReport state
-
Only one job can be in the running state
-
Running jobs transition directly to GeneratingReport once completed and no job is already generating a report.
-
and 2. are reasonable and fine, but I think 3. should be changed so that finished jobs unconditionally transition to NeedsReport the state used to schedule a retry of the report generation in case of report generation failure.
This way when a long job takes a long time generating a report and a following jobs finishes quickly those two don't block the queue and prevent the next job from starting.