You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Further, I wonder if add should not actually enqueue the jobs, and instead the batch would store the buffer of unpersisted jobs until enqueue was called. This feels like a breaking change... but I also think it's a necessary one (I'm not sure of the use-case why someone would want to add jobs to a batch but not have them trigger an enqueue callback). This also makes the Batch more idempotent (the whole enqueue step maybe could be done in a transaction, for example)
The text was updated successfully, but these errors were encountered:
bensheldon
changed the title
Further batch creation
Further defer batch creation
Apr 3, 2023
Thinking about #912, and looking at the Batch code, I think that it would be possible to defer creating the batch.
For example, if no jobs are added to a batch, don't save it yet:
good_job/app/models/good_job/batch.rb
Line 112 in 5280b37
Further, I wonder if
add
should not actually enqueue the jobs, and instead the batch would store the buffer of unpersisted jobs untilenqueue
was called. This feels like a breaking change... but I also think it's a necessary one (I'm not sure of the use-case why someone would want to add jobs to a batch but not have them trigger an enqueue callback). This also makes the Batch more idempotent (the whole enqueue step maybe could be done in a transaction, for example)The text was updated successfully, but these errors were encountered: