(e RecentError)
| 47 | } |
| 48 | |
| 49 | func (r *recentErrorRing) add(e RecentError) { |
| 50 | if r == nil { |
| 51 | return |
| 52 | } |
| 53 | r.mu.Lock() |
| 54 | r.buf[r.next] = e |
| 55 | r.next = (r.next + 1) % len(r.buf) |
| 56 | if r.n < len(r.buf) { |
| 57 | r.n++ |
| 58 | } |
| 59 | r.mu.Unlock() |
| 60 | } |
| 61 | |
| 62 | // snapshot returns up to limit most-recent errors, newest first (limit <= 0 |
| 63 | // returns all retained). |
no outgoing calls