()
| 191 | } |
| 192 | |
| 193 | func (e *MemoryEngine) evictLocked() { |
| 194 | now := time.Now() |
| 195 | for id, rec := range e.records { |
| 196 | if e.shouldEvictRecord(rec, now) { |
| 197 | delete(e.records, id) |
| 198 | } |
| 199 | } |
| 200 | for len(e.records) > e.maxRecords { |
| 201 | e.evictOneOldestLocked(now) |
| 202 | } |
| 203 | } |
| 204 | |
| 205 | func (e *MemoryEngine) shouldEvictRecord(rec *requestTiming, now time.Time) bool { |
| 206 | if !rec.endTime.IsZero() { |
no test coverage detected