countFail mutates the recent failures count by delta. It returns an error if the adjustment fails.
(delta int)
| 213 | // countFail mutates the recent failures count by |
| 214 | // delta. It returns an error if the adjustment fails. |
| 215 | func (h *Host) countFail(delta int) error { |
| 216 | result := h.fails.Add(int64(delta)) |
| 217 | if result < 0 { |
| 218 | return fmt.Errorf("count below 0: %d", result) |
| 219 | } |
| 220 | return nil |
| 221 | } |
| 222 | |
| 223 | // countHealthPass mutates the recent passes count by |
| 224 | // delta. It returns an error if the adjustment fails. |