countRequest mutates the active request count by delta. It returns an error if the adjustment fails.
(delta int)
| 203 | // countRequest mutates the active request count by |
| 204 | // delta. It returns an error if the adjustment fails. |
| 205 | func (h *Host) countRequest(delta int) error { |
| 206 | result := h.numRequests.Add(int64(delta)) |
| 207 | if result < 0 { |
| 208 | return fmt.Errorf("count below 0: %d", result) |
| 209 | } |
| 210 | return nil |
| 211 | } |
| 212 | |
| 213 | // countFail mutates the recent failures count by |
| 214 | // delta. It returns an error if the adjustment fails. |