Class: Ocelot::Watcher
- Inherits:
-
Object
- Object
- Ocelot::Watcher
- Defined in:
- lib/ocelot/processor.rb
Instance Attribute Summary collapse
-
#association ⇒ Object
Returns the value of attribute association.
-
#last ⇒ Object
readonly
Returns the value of attribute last.
-
#line ⇒ Object
Returns the value of attribute line.
-
#obj ⇒ Object
Returns the value of attribute obj.
-
#op ⇒ Object
Returns the value of attribute op.
-
#rule ⇒ Object
Returns the value of attribute rule.
-
#sql ⇒ Object
Returns the value of attribute sql.
Instance Method Summary collapse
-
#initialize ⇒ Watcher
constructor
A new instance of Watcher.
- #ping ⇒ Object
- #sync ⇒ Object
- #trace(event, file, line, id, binding, clazz) ⇒ Object
Constructor Details
#initialize ⇒ Watcher
Returns a new instance of Watcher.
11 12 13 14 |
# File 'lib/ocelot/processor.rb', line 11 def initialize @last = Time.now @mutex = Mutex.new end |
Instance Attribute Details
#association ⇒ Object
Returns the value of attribute association.
4 5 6 |
# File 'lib/ocelot/processor.rb', line 4 def association @association end |
#last ⇒ Object (readonly)
Returns the value of attribute last.
8 9 10 |
# File 'lib/ocelot/processor.rb', line 8 def last @last end |
#line ⇒ Object
Returns the value of attribute line.
6 7 8 |
# File 'lib/ocelot/processor.rb', line 6 def line @line end |
#obj ⇒ Object
Returns the value of attribute obj.
9 10 11 |
# File 'lib/ocelot/processor.rb', line 9 def obj @obj end |
#op ⇒ Object
Returns the value of attribute op.
3 4 5 |
# File 'lib/ocelot/processor.rb', line 3 def op @op end |
#rule ⇒ Object
Returns the value of attribute rule.
7 8 9 |
# File 'lib/ocelot/processor.rb', line 7 def rule @rule end |
#sql ⇒ Object
Returns the value of attribute sql.
5 6 7 |
# File 'lib/ocelot/processor.rb', line 5 def sql @sql end |
Instance Method Details
#ping ⇒ Object
20 21 22 23 24 |
# File 'lib/ocelot/processor.rb', line 20 def ping sync do |w| "Might be stuck processing #{w.obj}#{w.association.nil? ? "" : "."}#{w.association} at #{w.line} using #{w.rule}, may be exec'ing #{ActiveRecord::Base.connection.last_query}" if Time.now - w.last > 20 end end |
#sync ⇒ Object
26 27 28 29 30 |
# File 'lib/ocelot/processor.rb', line 26 def sync @mutex.synchronize do yield self end end |