106
return;
107
}
109
>
Entry._clock = 1;
110
>
const times = [...this._canonicalUris.values()].map(e => e.time);
111
>
const median = quickSelect(
112
>
Math.floor(times.length / 2),
113
>
times,
114
>
(a, b) => a - b);
115
>
for (const [key, entry] of this._canonicalUris.entries()) {
116
>
// Its important to remove the median value here (<= not <).
117
>
// If we have not touched any items since the last trim, the
118
>
// median will be 0 and no items will be removed otherwise.
119
>
if (entry.time <= median) {
120
>
this._canonicalUris.delete(key);
121
>
} else {
122
>
entry.time = 0;
123
>
}
124
>
}
125
}
126
}