MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / pruneLocked

Method pruneLocked

internal/redisqueue/queue.go:226–241  ·  view source on GitHub ↗
(now time.Time)

Source from the content-addressed store, hash-verified

224}
225
226func (q *queue) pruneLocked(now time.Time) {
227 if q.head >= len(q.items) {
228 q.items = nil
229 q.head = 0
230 return
231 }
232
233 windowSeconds := retentionSeconds.Load()
234 if windowSeconds <= 0 {
235 windowSeconds = defaultRetentionSeconds
236 }
237 cutoff := now.Add(-time.Duration(windowSeconds) * time.Second)
238 for q.head < len(q.items) && q.items[q.head].enqueuedAt.Before(cutoff) {
239 q.head++
240 }
241}
242
243func (q *queue) maybeCompactLocked() {
244 if q.head == 0 {

Callers 2

enqueueMethod · 0.95
popOldestMethod · 0.95

Calls 1

LoadMethod · 0.65

Tested by

no test coverage detected