(ms: number)
| 5681 | const idle: Idle = { expiresAt: now() + ttl, cancel: () => {} } |
| 5682 | entry.idle = idle |
| 5683 | const sleep = (ms: number): void => { |
| 5684 | idle.cancel = timer(ms, () => { |
| 5685 | if (entry.idle !== idle) return |
| 5686 | const remaining = idle.expiresAt - now() |
| 5687 | if (remaining > 0) return sleep(remaining) |
| 5688 | entry.idle = undefined |
| 5689 | if (idleEligible(entry)) removeEntry(entry) |
| 5690 | }) |
| 5691 | } |
| 5692 | sleep(ttl) |
| 5693 | } |
| 5694 | /** Called whenever the entry may have gone quiet: removes a cold one, starts the timer on a settled one. */ |
no test coverage detected