We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent bca41d6 commit cc2d1e3Copy full SHA for cc2d1e3
app/models/solid_queue/job_batch.rb
@@ -11,7 +11,7 @@ class JobBatch < Record
11
12
class << self
13
def current_batch_id
14
- Thread.current[:current_batch_id]
+ ActiveSupport::IsolatedExecutionState[:current_batch_id]
15
end
16
17
def enqueue(attributes = {})
@@ -20,13 +20,13 @@ def enqueue(attributes = {})
20
job_batch = nil
21
transaction do
22
job_batch = create!(batch_attributes(attributes))
23
- Thread.current[:current_batch_id] = job_batch.id
+ ActiveSupport::IsolatedExecutionState[:current_batch_id] = job_batch.id
24
yield
25
26
27
job_batch
28
ensure
29
- Thread.current[:current_batch_id] = previous_batch_id
+ ActiveSupport::IsolatedExecutionState[:current_batch_id] = previous_batch_id
30
31
32
def dispatch_finished_batches
0 commit comments