Closed up2jj closed 5 months ago
The current implementation of both Batch.new can't gracefully handle streams. For this to be effective, Batch.new would need to return a stream rather than a list.
There are some other big changes coming for Batches, and we'll keep this in mind. In the meantime, you can safely keep injecting a batch_id into meta (it's private, but won't be changing).
Thanks for the explanation 👍🏻
This is on main for oban_pro and will be out soon (🤞) with v1.5
Currently,
Oban.Pro.Workers.Batch.new_batch/2
accepts list of args/jobs so it is not possible to prepare batch in streaming fashion like this:I made a workaround by adding
batch_id
manually:and it seems to work, but I have mixed feeling about this as this approach relies on Oban's internals (meta, batch_id, etc.). I know that
new_batch/1
can be overridden but I believe it should be handled natively.