Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Change where and how InterruptedException is handled.

  • Loading branch information...
commit 84c574c4ded60c83069561f7e158055c9e737285 1 parent 2ab2191
Seth Morabito authored
Showing with 7 additions and 9 deletions.
  1. +7 −9 server/lib/bdrb_thread_pool.rb
View
16 server/lib/bdrb_thread_pool.rb
@@ -57,15 +57,10 @@ def add_thread
Thread.current[:job_key] = nil
Thread.current[:persistent_job_id] = nil
while true
- begin
- task = @work_queue.pop
- Thread.current[:job_key] = task.job_key
- Thread.current[:persistent_job_id] = task.persistent_job_id
- block_result = run_task(task)
- rescue InterruptedException
- # Allow threads to be interrupted, then continue
- next
- end
+ task = @work_queue.pop
+ Thread.current[:job_key] = task.job_key
+ Thread.current[:persistent_job_id] = task.persistent_job_id
+ block_result = run_task(task)
end
end
end
@@ -83,6 +78,9 @@ def run_task task
result = master.send(task.job_method)
end
return result
+ rescue BackgrounDRb::InterruptedException
+ # Don't log, just return nil.
+ return nil
rescue
logger.info($!.to_s)
logger.info($!.backtrace.join("\n"))
Please sign in to comment.
Something went wrong with that request. Please try again.