Class: ReReplay::TimeoutFailer

Inherits:
Object
  • Object
show all
Defined in:
lib/rereplay/monitors/timeout_failer.rb

Defined Under Namespace

Classes: Timeout

Instance Method Summary collapse

Constructor Details

#initialize(max_timeouts = 1) ⇒ TimeoutFailer

Returns a new instance of TimeoutFailer.



4
5
6
7
# File 'lib/rereplay/monitors/timeout_failer.rb', line 4

def initialize(max_timeouts=1)
	@max_timeouts = max_timeouts
	@timeouts = 0
end

Instance Method Details

#finish(request) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/rereplay/monitors/timeout_failer.rb', line 9

def finish(request)
	if(request.status == :timeout)
		@timeouts += 1
	end
	if(@timeouts >= @max_timeouts)
		raise Timeout, "TimeoutFailer triggered because timeout limit #{@max_timeouts} was reached"
	end
end