Skip to content

Commit

Permalink
fix issue with @seen in wait_logger on JRuby
Browse files Browse the repository at this point in the history
(thanks Mark Wotton)

closes gh-77
  • Loading branch information
jmettraux committed Mar 21, 2013
1 parent b7eeff0 commit 6a97f14
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.txt
Expand Up @@ -4,6 +4,7 @@

== ruote - 2.3.1 not yet released

- fix issue with @seen in wait_logger on JRuby (thanks Mark Wotton)
- Receiver#flunk accepts stacktrace as final argument
- allow for "1x == 2x" (turn it into "'1x' == '2x'") (== and !=)
- fix parsing '2013-02-08T17:36:10Z' (reported by Hartog de Mik)
Expand Down
1 change: 1 addition & 0 deletions CREDITS.txt
Expand Up @@ -58,6 +58,7 @@ Richard Jennings

== Feedback

Mark Wotton - https://github.com/mwotton - issue with @seen on JRuby
Herve Chardenoux - tests on Windows
Larry Marburger - await attribute clarifications
Tobias Neubert - jump to participant 'x'
Expand Down
12 changes: 8 additions & 4 deletions lib/ruote/log/wait_logger.rb
Expand Up @@ -87,6 +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
end

Expand All @@ -99,11 +100,14 @@ def on_msg(msg)

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

@seen << msg
@log << msg
@on_msg_mutex.synchronize do

while @log.size > @log_max; @log.shift; end
while @seen.size > @log_max; @seen.shift; end
@seen << msg
@log << msg

while @log.size > @log_max; @log.shift; end
while @seen.size > @log_max; @seen.shift; end
end
end

# Returns an array of the latest msgs, but fancy-printed. The oldest
Expand Down

0 comments on commit 6a97f14

Please sign in to comment.