lib/bluepill/triggers/flapping.rb in ra-bluepill-0.0.44 vs lib/bluepill/triggers/flapping.rb in ra-bluepill-0.0.45

- old
+ new

@@ -41,19 +41,17 @@ duration = (@timeline.last - @timeline.first) <= self.within if duration self.logger.info "Flapping detected: retrying in #{self.retry_in} seconds" - self.schedule_event(:start, self.retry_in) - - # this happens in the process' thread so we don't have to worry about concurrency issues with this event - self.dispatch!(:unmonitor) - + self.schedule_event(:start, self.retry_in) unless self.retry_in == 0 # retry_in zero means "do not retry, ever" + self.schedule_event(:unmonitor, 0) + @timeline.clear # This will prevent a transition from happening in the process state_machine throw :halt end end end end -end \ No newline at end of file +end