We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d6facee commit 908cee4Copy full SHA for 908cee4
app/models/solid_queue/batch.rb
@@ -24,15 +24,17 @@ class Batch < Record
24
def enqueue(&block)
25
raise "You cannot enqueue a batch that is already finished" if finished?
26
27
- save! if new_record?
+ transaction do
28
+ save! if new_record?
29
- Batch.wrap_in_batch_context(batch_id) do
30
- block.call(self)
31
- end
+ Batch.wrap_in_batch_context(batch_id) do
+ block.call(self)
32
+ end
33
- if ActiveRecord.respond_to?(:after_all_transactions_commit)
34
- ActiveRecord.after_all_transactions_commit do
35
- start_batch
+ if ActiveRecord.respond_to?(:after_all_transactions_commit)
+ ActiveRecord.after_all_transactions_commit do
36
+ start_batch
37
38
end
39
40
0 commit comments