Skip to content

Instantly share code, notes, and snippets.

@jmettraux
Created March 21, 2013 22:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmettraux/5217277 to your computer and use it in GitHub Desktop.
Save jmettraux/5217277 to your computer and use it in GitHub Desktop.
# The context will call this method for each msg sucessfully processed
# by the worker.
#
def on_msg(msg)
puts(fancy_print(msg, @noisy)) if @noisy
return if msg['action'] == 'noop'
@on_msg_mutex.synchronize do
@seen << msg
@log << msg
while @log.size > @log_max; @log.shift; end
while @seen.size > @log_max; @seen.shift; end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment