Skip to content

Commit cd22f67

Browse files
committed
log ignored exceptions on DEBUG level
1 parent 8d64ed1 commit cd22f67

File tree

7 files changed

+15
-5
lines changed

7 files changed

+15
-5
lines changed

lib/concurrent/actress.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
require 'logger'
2-
31
require 'concurrent/configuration'
42
require 'concurrent/executor/one_by_one'
53
require 'concurrent/ivar'

lib/concurrent/agent.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
require 'concurrent/observable'
55
require 'concurrent/options_parser'
66
require 'concurrent/utility/timeout'
7+
require 'concurrent/logging'
78

89
module Concurrent
910

@@ -35,6 +36,7 @@ module Concurrent
3536
class Agent
3637
include Dereferenceable
3738
include Concurrent::Observable
39+
include Logging
3840

3941
# The default timeout value (in seconds); used when no timeout option
4042
# is given at initialization
@@ -192,7 +194,8 @@ def try_rescue(ex) # :nodoc:
192194
end
193195
rescuer.block.call(ex) if rescuer
194196
rescue Exception => ex
195-
# supress
197+
# suppress
198+
log DEBUG, ex
196199
end
197200

198201
# @!visibility private

lib/concurrent/configuration.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
require 'concurrent/utility/processor_count'
77

88
module Concurrent
9+
extend Logging
910

1011
# A gem-level configuration object.
1112
class Configuration
@@ -134,7 +135,8 @@ def self.finalize_executor(executor)
134135
executor.kill
135136
end
136137
true
137-
rescue
138+
rescue => ex
139+
log DEBUG, ex
138140
false
139141
end
140142

lib/concurrent/executor/executor.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
require 'concurrent/errors'
2+
require 'concurrent/logging'
23
require 'concurrent/atomic/event'
34

45
module Concurrent
@@ -11,6 +12,7 @@ def can_overflow?
1112

1213
module RubyExecutor
1314
include Executor
15+
include Logging
1416

1517
# Submit a task to the executor for asynchronous processing.
1618
#

lib/concurrent/executor/ruby_single_thread_executor.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def work
6464
task.last.call(*task.first)
6565
rescue => ex
6666
# let it fail
67+
log DEBUG, ex
6768
end
6869
end
6970
stopped_event.set

lib/concurrent/executor/ruby_thread_pool_executor.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,9 @@ def handle_overflow(*args)
237237
when :caller_runs
238238
begin
239239
yield(*args)
240-
rescue
240+
rescue => ex
241241
# let it fail
242+
log DEBUG, ex
242243
end
243244
true
244245
end

lib/concurrent/executor/ruby_thread_pool_worker.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
require 'thread'
2+
require 'concurrent/logging'
23

34
module Concurrent
45

56
# @!visibility private
67
class RubyThreadPoolWorker
8+
include Logging
79

810
# @!visibility private
911
def initialize(queue, parent)
@@ -59,6 +61,7 @@ def run(thread = Thread.current)
5961
task.last.call(*task.first)
6062
rescue => ex
6163
# let it fail
64+
log DEBUG, ex
6265
ensure
6366
@last_activity = Time.now.to_f
6467
@parent.on_end_task

0 commit comments

Comments
 (0)