Class: Mediakit::Process::Runner::TimeoutTimer
- Inherits:
-
Coolio::TimerWatcher
- Object
- Coolio::TimerWatcher
- Mediakit::Process::Runner::TimeoutTimer
- Defined in:
- lib/mediakit/process/runner.rb
Constant Summary collapse
- DEFAULT_CHECK_INTERVAL =
0.1
Instance Method Summary collapse
-
#initialize(duration, current_thread) ⇒ TimeoutTimer
constructor
A new instance of TimeoutTimer.
- #on_timer ⇒ Object
- #update ⇒ Object
Constructor Details
#initialize(duration, current_thread) ⇒ TimeoutTimer
Returns a new instance of TimeoutTimer.
140 141 142 143 144 145 |
# File 'lib/mediakit/process/runner.rb', line 140 def initialize(duration, current_thread) @duration = duration @watched_at = Time.now @current_thread = current_thread super(DEFAULT_CHECK_INTERVAL, true) end |
Instance Method Details
#on_timer ⇒ Object
147 148 149 150 151 |
# File 'lib/mediakit/process/runner.rb', line 147 def on_timer if timeout? @current_thread.raise(Timeout::Error, "wait timeout error with #{@duration} sec.") end end |
#update ⇒ Object
153 154 155 |
# File 'lib/mediakit/process/runner.rb', line 153 def update @watched_at = Time.now end |