Repeatedly flush until `predicate` holds or the budget runs out.
(predicate: () => boolean, attempts = 40)
| 124 | |
| 125 | /** Repeatedly flush until `predicate` holds or the budget runs out. */ |
| 126 | async function flushUntil(predicate: () => boolean, attempts = 40) { |
| 127 | for (let i = 0; i < attempts; i++) { |
| 128 | if (predicate()) return |
| 129 | await flush() |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | /** True when the getSession call is the upgrade (disableCookieCache) read. */ |
| 134 | function isUpgradeCall(arg: unknown): boolean { |
no test coverage detected