( regions: readonly Region[], maxStored: number, )
| 285 | // garbageCollectStoredLatencies will remove any latencies that are older then 1 week or latencies of proxies |
| 286 | // that no longer exist. This is intended to keep the size of local storage down. |
| 287 | const garbageCollectStoredLatencies = ( |
| 288 | regions: readonly Region[], |
| 289 | maxStored: number, |
| 290 | ): void => { |
| 291 | const latencies = loadStoredLatencies(); |
| 292 | const now = Date.now(); |
| 293 | const cleaned = cleanupLatencies( |
| 294 | latencies, |
| 295 | regions, |
| 296 | new Date(now), |
| 297 | maxStored, |
| 298 | ); |
| 299 | |
| 300 | localStorage.setItem("workspace-proxy-latencies", JSON.stringify(cleaned)); |
| 301 | }; |
| 302 | |
| 303 | const cleanupLatencies = ( |
| 304 | stored: Record<string, ProxyLatencyReport[]>, |
no test coverage detected