Skip to content

Commit

Permalink
further harden wait_logger
Browse files Browse the repository at this point in the history
closes gh-77, hopefully
  • Loading branch information
jmettraux committed Mar 22, 2013
1 parent 6a97f14 commit 6aacbbb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/ruote/log/wait_logger.rb
Expand Up @@ -87,8 +87,7 @@ def initialize(context)
@log_max = context['wait_logger_max'] || 77
@timeout = context['wait_logger_timeout'] || 60 # in seconds

@on_msg_mutex = Mutex.new
@check_mutex = Mutex.new
@mutex = Mutex.new
end

# The context will call this method for each msg sucessfully processed
Expand All @@ -100,7 +99,7 @@ def on_msg(msg)

return if msg['action'] == 'noop'

@on_msg_mutex.synchronize do
@mutex.synchronize do

@seen << msg
@log << msg
Expand Down Expand Up @@ -154,7 +153,7 @@ def wait_for(interests, opts={})
Ruote::LoggerTimeout.new(interests, to)
) if to && (Time.now - start) > to

@check_mutex.synchronize { check_waiting }
@mutex.synchronize { check_waiting }

break if Thread.current['__result__']

Expand Down

0 comments on commit 6aacbbb

Please sign in to comment.