lib/ruote/log/wait_logger.rb in ruote-2.3.0.1 vs lib/ruote/log/wait_logger.rb in ruote-2.3.0.2

- old
+ new

@@ -1,7 +1,7 @@ #-- -# Copyright (c) 2005-2012, John Mettraux, jmettraux@gmail.com +# Copyright (c) 2005-2013, John Mettraux, jmettraux@gmail.com # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell @@ -36,11 +36,11 @@ end # # The logic behind Ruote::Dashboard#wait_for is implemented here. # - # This logger keeps track of the last 147 events. This number can + # This logger keeps track of the last 56 events. This number can # be tweaked via the 'wait_logger_max' storage option # (http://ruote.rubyforge.org/configuration.html) # # One doesn't play directly with this class. It's available only via # the Ruote::Dashboard#wait_for and Ruote::Dashboard#noisy= @@ -49,11 +49,11 @@ # at this wait_logger. # # === options (storage initialization options) # # wait_logger_max(Integer):: - # defaults to 147, max number of recent records to keep track of + # defaults to 77, max number of recent records to keep track of # wait_logger_timeout(Integer):: # defaults to 60 (seconds), #wait_for times out after how many seconds? # class WaitLogger @@ -82,11 +82,11 @@ @count = -1 @color = 33 @noisy = false - @log_max = context['wait_logger_max'] || 147 + @log_max = context['wait_logger_max'] || 77 @timeout = context['wait_logger_timeout'] || 60 # in seconds @check_mutex = Mutex.new end @@ -176,12 +176,16 @@ def check_waiting while @waiting.any? and msg = @seen.shift @waiting.delete_if do |thread, interests| - thread['__result__'] = msg if matches(interests, msg) - (interests.size < 1) + if matches(interests, msg) + thread['__result__'] = msg + true + else + false + end end end end FINAL_ACTIONS = %w[ @@ -265,10 +269,14 @@ end interests.delete(interest) if satisfied end - (interests.size < 1) + if interests.include?(:or_error) + (interests.size < 2) + else + (interests.size < 1) + end end end end