(entry: PRContextCacheEntry)
| 309 | } |
| 310 | |
| 311 | private scheduleNext(entry: PRContextCacheEntry): void { |
| 312 | if (entry.watchers === 0 || entry.timer !== null) return; |
| 313 | |
| 314 | const now = this.now(); |
| 315 | const nextRefreshAt = |
| 316 | entry.nextAllowedRefreshAt > now |
| 317 | ? entry.nextAllowedRefreshAt |
| 318 | : now + this.refreshIntervalMs; |
| 319 | const delayMs = Math.max(0, nextRefreshAt - now); |
| 320 | |
| 321 | entry.timer = this.setTimer(() => { |
| 322 | entry.timer = null; |
| 323 | this.runDetached(this.refresh(entry.url, entry.ref, "timer"), "timer"); |
| 324 | }, delayMs); |
| 325 | } |
| 326 | |
| 327 | private clearScheduledTimer(entry: PRContextCacheEntry): void { |
| 328 | if (!entry.timer) return; |
no test coverage detected