* Ends a wait whose time has passed but whose timer never fired because the * host refused it, so a refused timer cannot hold reads for the whole * session. * * @param engine the bound host
(engine: Host)
| 531 | * @param engine the bound host |
| 532 | */ |
| 533 | async function endOverdueRest(engine: Host) { |
| 534 | const timer = timers.get('rest') |
| 535 | const dueMs = restDueMs |
| 536 | const nowMs = await engine.now().catch(() => null) |
| 537 | |
| 538 | const isOverdue = |
| 539 | timer !== undefined && |
| 540 | timers.get('rest') === timer && |
| 541 | dueMs !== null && |
| 542 | nowMs !== null && |
| 543 | nowMs >= dueMs |
| 544 | |
| 545 | if (isOverdue) { |
| 546 | endRest(engine) |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | /** |
| 551 | * Starts the read kept while a read ran or a wait held it: at once if it |
no test coverage detected