Skip to content

Commit ee0f08d

Browse files
More idiomatic but still failing
1 parent f08d212 commit ee0f08d

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/Symfony/Component/HttpClient/Response/AmpResponse.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ final class AmpResponse implements ResponseInterface, StreamableInterface
4949
private ?array $options;
5050
private \Closure $onProgress;
5151

52-
private static ?string $delay = null;
53-
private static Suspension $suspension;
52+
private static ?DeferredCancellation $delay = null;
5453

5554
/**
5655
* @internal
@@ -182,9 +181,8 @@ private static function perform(ClientState $multi, array &$responses = null): v
182181
*/
183182
private static function select(ClientState $multi, float $timeout): int
184183
{
185-
self::$suspension ??= EventLoop::getSuspension();
186-
self::$delay = EventLoop::delay($timeout, self::$suspension->resume(...));
187-
self::$suspension->suspend();
184+
self::$delay ??= new DeferredCancellation();
185+
delay($timeout, true, self::$delay->getCancellation());
188186

189187
return null === self::$delay ? 1 : 0;
190188
}
@@ -415,10 +413,8 @@ private static function getPushedResponse(Request $request, AmpClientState $mult
415413
private static function stopLoop(): void
416414
{
417415
if (null !== self::$delay) {
418-
EventLoop::cancel(self::$delay);
416+
self::$delay->cancel();
419417
self::$delay = null;
420418
}
421-
422-
EventLoop::defer(self::$suspension->resume(...));
423419
}
424420
}

0 commit comments

Comments
 (0)