Skip to content

Instantly share code, notes, and snippets.

@jmettraux

jmettraux/on_msg.rb

Created Mar 21, 2013
Embed
What would you like to do?
# 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
You can’t perform that action at this time.