Module: Zold::ThreadBadge
- Included in:
- Alias, Calculate, Create, Diff, Fetch, Invoice, List, Merge, Next, Node, Pay, Propagate, Pull, Push, Remote, Remove, Show, Taxes
- Defined in:
- lib/zold/commands/thread_badge.rb
Overview
This module should be included in each command, in order to label the current Thread correctly, when the command is running. This is mostly useful for debugging/testing purposes - want to be able to see what’s going on in the thread when it gets stuck with a Futex.
Since all commands have exactly the same external interface and implement the method “run,” we catch all calls to this method and label the current thread properly. We label it back when it’s over.
Instance Method Summary collapse
Instance Method Details
#run(args = []) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/zold/commands/thread_badge.rb', line 20 def run(args = []) before = Thread.current.name || '' Thread.current.name = "#{before}:#{self.class.name.gsub(/^Zold::/, '')}" begin super ensure Thread.current.name = before end end |