Commit 8b80116
fix(server): await _handleProcessingError so blocking drains surface errors
`_processEvents` catches errors from the event-processing loop and delegates
to `_handleProcessingError`, which — per its own comment — re-throws on the
blocking path (no `firstResultRejector`) "so the caller's await catches it".
The call was not awaited. `_handleProcessingError` is async, so its throw
became a floating rejection instead of propagating out of `_processEvents`.
The generator resolved as if the drain had succeeded, and the one blocking
caller with no `firstResultRejector` — `cancelTask`'s drain — silently
swallowed the failure. It then reloaded the task, saw a non-canceled state,
and threw a misleading `TaskNotCancelableError` (masking the real error),
while the true error surfaced as an unhandled promise rejection.
Await the call. The blocking re-throw now propagates through the `finally`
(which still detaches the queue) and out to the awaiting caller, matching
the documented intent. The non-blocking paths are unaffected: they pass a
`firstResultRejector`, so `_handleProcessingError` rejects/persists rather
than throwing.
Adds a regression test asserting `cancelTask` surfaces a drain-time
persistence error instead of masking it with `TaskNotCancelableError`.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 477e394 commit 8b80116
2 files changed
Lines changed: 64 additions & 1 deletion
File tree
- src/server/request_handler
- test/server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
322 | 322 | | |
323 | 323 | | |
324 | 324 | | |
325 | | - | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
326 | 330 | | |
327 | 331 | | |
328 | 332 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3277 | 3277 | | |
3278 | 3278 | | |
3279 | 3279 | | |
| 3280 | + | |
| 3281 | + | |
| 3282 | + | |
| 3283 | + | |
| 3284 | + | |
| 3285 | + | |
| 3286 | + | |
| 3287 | + | |
| 3288 | + | |
| 3289 | + | |
| 3290 | + | |
| 3291 | + | |
| 3292 | + | |
| 3293 | + | |
| 3294 | + | |
| 3295 | + | |
| 3296 | + | |
| 3297 | + | |
| 3298 | + | |
| 3299 | + | |
| 3300 | + | |
| 3301 | + | |
| 3302 | + | |
| 3303 | + | |
| 3304 | + | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
| 3309 | + | |
| 3310 | + | |
| 3311 | + | |
| 3312 | + | |
| 3313 | + | |
| 3314 | + | |
| 3315 | + | |
| 3316 | + | |
| 3317 | + | |
| 3318 | + | |
| 3319 | + | |
| 3320 | + | |
| 3321 | + | |
| 3322 | + | |
| 3323 | + | |
| 3324 | + | |
| 3325 | + | |
| 3326 | + | |
| 3327 | + | |
| 3328 | + | |
| 3329 | + | |
| 3330 | + | |
| 3331 | + | |
| 3332 | + | |
| 3333 | + | |
| 3334 | + | |
| 3335 | + | |
| 3336 | + | |
| 3337 | + | |
| 3338 | + | |
3280 | 3339 | | |
3281 | 3340 | | |
3282 | 3341 | | |
| |||
0 commit comments