Skip to content

Commit cc2d1e3

Browse files
committed
Use ActiveSupport::IsolatedExecutionState to honor user isolation level setting
1 parent bca41d6 commit cc2d1e3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: app/models/solid_queue/job_batch.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class JobBatch < Record
1111

1212
class << self
1313
def current_batch_id
14-
Thread.current[:current_batch_id]
14+
ActiveSupport::IsolatedExecutionState[:current_batch_id]
1515
end
1616

1717
def enqueue(attributes = {})
@@ -20,13 +20,13 @@ def enqueue(attributes = {})
2020
job_batch = nil
2121
transaction do
2222
job_batch = create!(batch_attributes(attributes))
23-
Thread.current[:current_batch_id] = job_batch.id
23+
ActiveSupport::IsolatedExecutionState[:current_batch_id] = job_batch.id
2424
yield
2525
end
2626

2727
job_batch
2828
ensure
29-
Thread.current[:current_batch_id] = previous_batch_id
29+
ActiveSupport::IsolatedExecutionState[:current_batch_id] = previous_batch_id
3030
end
3131

3232
def dispatch_finished_batches

0 commit comments

Comments
 (0)