Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 8be0590

Browse files
authored
Merge pull request #22 from reactphp-parallel/give-proxy-time-to-clean-up
Give proxy time to clean up during metrics tests
2 parents 20f6f17 + c0c8955 commit 8be0590

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/ProxyTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use Psr\Container\ContainerInterface;
99
use Psr\Log\LoggerInterface;
1010
use React\EventLoop\Factory as EventLoopFactory;
11+
use React\Promise\Promise;
12+
use React\Promise\PromiseInterface;
1113
use React\Promise\Timer\TimeoutException;
1214
use ReactParallel\Factory;
1315
use ReactParallel\ObjectProxy\NonExistentInterface;
@@ -130,7 +132,13 @@ public function metricsDestructionTesting(): void
130132
try {
131133
$results = $this->await(
132134
// @phpstan-ignore-next-line
133-
all($promises)->always(static function () use ($limitedPool): void {
135+
all($promises)->then(static function (array $v) use ($factory): PromiseInterface {
136+
return new Promise(static function (callable $resolve) use ($v, $factory): void {
137+
$factory->loop()->addTimer(3, static function () use ($resolve, $v): void {
138+
$resolve($v);
139+
});
140+
});
141+
})->always(static function () use ($limitedPool): void {
134142
$limitedPool->close();
135143
}),
136144
$loop

0 commit comments

Comments
 (0)