package rproxy import "time" // StopBreakerClock has the circuit breaker of s read at as the time, so that how // long requests take cannot matter to it. It is called before s serves. func (s *Server) StopBreakerClock(at time.Time) { s.h.breakerClock = func() time.Time { return at } } // Breaker is the circuit breaker, for tests that give it the time. type Breaker struct { b breaker } // MayAsk reports whether a request may ask waf at now. func (b *Breaker) MayAsk(now time.Time) bool { return b.b.mayAsk(now) } // NoteAnswer notes that an ask got an answer rproxy can use. func (b *Breaker) NoteAnswer() { b.b.noteAnswer() } // NoteFailure notes that an ask that ended at now got no answer in time. func (b *Breaker) NoteFailure(now time.Time) { b.b.noteFailure(now) }