Skip to content

Commit

Permalink
💚 server may be too slow on CI :D
Browse files Browse the repository at this point in the history
  • Loading branch information
Nek- committed Oct 17, 2024
1 parent 130867d commit c4edb83
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/Controller/SubscribeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ public function handleRequest(Request $request): Response
/** @var array{subscribe: array|string|null, payload?: array} $jwtContent */
$jwtContent = $request->getAttribute(Security::ATTRIBUTE_JWT_PAYLOAD)['mercure'] ?? [];

$topics = (array) $query['topic'];
$subscriber = new Subscriber(
(array) $query['topic'],
$topics,
$this->validateAndReturnTopics((array) ($jwtContent['subscribe'] ?? [])),
(array) ($jwtContent['payload'] ?? []),
$lastEventId
Expand Down
1 change: 1 addition & 0 deletions tests/Functional/SendUpdateTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use SwagIndustries\MercureRouter\Test\Functional\Tool\TestClient;
use SwagIndustries\MercureRouter\Test\Functional\Tool\TestSubscriber;
use function Amp\async;
use function Amp\delay;
use function Amp\Future\await;

class SendUpdateTest extends AbstractFunctionalTest
Expand Down
4 changes: 2 additions & 2 deletions tests/Functional/Tool/TestSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,13 @@ public function received(array $data): Future
$data = json_encode($data, flags: JSON_THROW_ON_ERROR);

return async(function () use ($data) {
for ($i = 0; $i < 10; $i++) {
for ($i = 0; $i < 20; $i++) {
if (str_contains($this->buffer, $data)) {
$this->stop();
return true;
}

delay(0.1); // Wait for 1 second for a message to be received
delay(0.1); // Wait for 2 second (0.1*20) for a message to be received
}

$this->stop();
Expand Down

0 comments on commit c4edb83

Please sign in to comment.