()
| 205 | } |
| 206 | |
| 207 | async #drain(): Promise<void> { |
| 208 | try { |
| 209 | await this.#drainAllChunks() |
| 210 | } catch (e) { |
| 211 | // Transient fs errors (EMFILE on busy CI, EPERM on Windows pending- |
| 212 | // delete) previously rode up through `void this.#drain()` as an |
| 213 | // unhandled rejection while the flush promise resolved anyway — callers |
| 214 | // saw an empty file with no error. Retry once for the transient case |
| 215 | // (queue is intact if open() failed), then log and give up. |
| 216 | logError(e) |
| 217 | if (this.#queue.length > 0) { |
| 218 | try { |
| 219 | await this.#drainAllChunks() |
| 220 | } catch (e2) { |
| 221 | logError(e2) |
| 222 | } |
| 223 | } |
| 224 | } finally { |
| 225 | const resolve = this.#flushResolve! |
| 226 | this.#flushPromise = null |
| 227 | this.#flushResolve = null |
| 228 | resolve() |
| 229 | } |
| 230 | } |
| 231 | } |
| 232 | |
| 233 | const outputs = new Map<string, DiskTaskOutput>() |
no test coverage detected