Skip to content

Commit 0b05167

Browse files
committed
Report errors to the error reporter
1 parent a57660c commit 0b05167

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

lib/solid_queue/pool.rb

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,10 @@ def post(execution)
1919
available_threads.decrement
2020

2121
future = Concurrent::Future.new(args: [ execution ], executor: executor) do |thread_execution|
22-
wrap_in_app_executor do
23-
thread_execution.perform
24-
ensure
25-
available_threads.increment
26-
mutex.synchronize { on_idle.try(:call) if idle? }
27-
end
22+
thread_execution.perform
23+
ensure
24+
available_threads.increment
25+
mutex.synchronize { on_idle.try(:call) if idle? }
2826
end
2927

3028
future.add_observer do |_, _, error|

test/unit/worker_test.rb

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,17 +51,15 @@ class WorkerTest < ActiveSupport::TestCase
5151
subscriber = ErrorBuffer.new
5252
Rails.error.subscribe(subscriber)
5353

54-
SolidQueue::ClaimedExecution::Result.expects(:new).raises(RuntimeError.new("everything is broken")).at_least_once
55-
56-
AddToBufferJob.perform_later "hey!"
54+
RaisingJob.perform_later(RuntimeError, "B")
5755

5856
@worker.start
5957

6058
wait_for_jobs_to_finish_for(1.second)
6159
@worker.wake_up
6260

6361
assert_equal 1, subscriber.errors.count
64-
assert_equal "everything is broken", subscriber.messages.first
62+
assert_equal "This is a RuntimeError exception", subscriber.messages.first
6563
ensure
6664
Rails.error.unsubscribe(subscriber) if Rails.error.respond_to?(:unsubscribe)
6765
SolidQueue.on_thread_error = original_on_thread_error

0 commit comments

Comments
 (0)