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
37 38 39 40 41 42 43 44 45 |
# File 'lib/zold/commands/thread_badge.rb', line 37 def run(args = []) before = Thread.current.name || '' Thread.current.name = "#{before}:#{self.class.name.gsub(/^Zold::/, '')}" begin super(args) ensure Thread.current.name = before end end |