-
-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I add jobs to an existing batch? #1337
Comments
That's weird! I just tried this exploratory test and it passes: describe 'adding to an existing batch' do
it 'will add jobs to the existing batch' do
batch = GoodJob::Batch.new(metadata: 'foo')
batch.enqueue { TestJob.perform_later }
GoodJob::Batch.find(batch.id).enqueue { TestJob.perform_later }
batch = GoodJob::Batch.find(batch.id)
expect(batch.active_jobs.count).to eq 2
end
end Have you done anything to the |
Hmmm.....
Also, maybe of note, I am trying to test this using the Rails test job adapter. Finally, this doesn't work outside of the test (in a manual integration test) either. |
That's it ☝ (or at least one issue). Batches can only batch jobs that are enqueued to GoodJob. That makes me think I could at least add a logger to the Batch job extension to log on enqueue like "This job was enqueued within a batch capture but not to the GoodJob Adapter; the job will not appear in the batch." |
That seems good. |
I just opened #1339 with a warning message. Could you try that locally and see if it helps debug better? |
Thank you! |
I just released those debug messages in https://github.com/bensheldon/good_job/releases/tag/v3.28.2 |
I'm having trouble understanding how to add new jobs to an existing batch.
Here's what I'm doing:
I see my jobs performing wonderfully.
I see a batch created
There are no jobs in my batch (neither in Batch panel in GoodJobs dashboard, or is the GoodJobs::Job#batch_id set)
Can you advise on how to do this?
The text was updated successfully, but these errors were encountered: