Skip to content

Fix HTTP batch cleanup after callback exceptions#59548

Open
Nipun404 wants to merge 1 commit intolaravel:13.xfrom
Nipun404:fix-http-batch
Open

Fix HTTP batch cleanup after callback exceptions#59548
Nipun404 wants to merge 1 commit intolaravel:13.xfrom
Nipun404:fix-http-batch

Conversation

@Nipun404
Copy link
Copy Markdown
Contributor

@Nipun404 Nipun404 commented Apr 5, 2026

Summary

  • ensure HTTP client batches always clean up internal state when a batch callback throws
  • add a regression test covering exceptions thrown from the progress callback

Problem

Illuminate\Http\Client\Batch::send() marked the batch as in progress before dispatching requests, but only reset inProgress and finishedAt at the normal end of the method.

If a user-supplied batch callback like progress(...) threw an exception, execution exited send() early and skipped that cleanup. This left the batch object in a stale state where it still appeared to be running.

Fix

  • wrap the main send() flow in try / finally
  • keep exception behavior unchanged
  • always reset:
    • finishedAt
    • inProgress

@Nipun404 Nipun404 closed this Apr 5, 2026
@Nipun404 Nipun404 deleted the fix-http-batch branch April 5, 2026 18:41
@Nipun404 Nipun404 restored the fix-http-batch branch April 5, 2026 18:53
@Nipun404 Nipun404 reopened this Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant