Skip to content

Commit

Permalink
Return early if cancellation has already been requested
Browse files Browse the repository at this point in the history
  • Loading branch information
trowski committed Feb 11, 2025
1 parent 7e59a4a commit f2b745b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/GuzzleHandlerAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ public function __invoke(PsrRequest $request, array $options): PromiseInterface
/** @psalm-suppress UndefinedVariable Using $promise reference in definition expression. */
$promise = new Promise(
function () use (&$promise, $future, $cancellation, $deferredCancellation): void {
if ($deferredCancellation->isCancelled()) {
return;
}

try {
/** @var PsrResponse $response */
$response = $future->await();
Expand Down

0 comments on commit f2b745b

Please sign in to comment.