Skip to content

Commit

Permalink
keep reply and timeout check flags on ping msg
Browse files Browse the repository at this point in the history
  • Loading branch information
nekufa committed Feb 21, 2024
1 parent 049974b commit 5dab15b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public function process(null|int|float $timeout = 0, bool $reply = true, bool $c
if ($now >= $max) {
return null;
}
return $this->process($max - $now);
return $this->process($max - $now, $reply, $checkTimeout);

case 'PONG':
$this->logger?->debug('receive ' . $line);
Expand Down
18 changes: 18 additions & 0 deletions tests/Functional/StreamTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,24 @@ class StreamTest extends FunctionalTestCase

private bool $empty;

public function testConsumerExpiration()
{
$client = $this->createClient(['timeout' => 0.1, 'delay' => 0.1]);
$stream = $client->getApi()->getStream('empty');
$stream->getConfiguration()
->setSubjects(['empty']);

$stream->create();
$consumer = $stream->getConsumer('empty')->create();
$consumer->getConfiguration()->setSubjectFilter('empty');

$info = $client->info;

$consumer->setIterations(1)->setExpires(3)->handle(function () {
});
$this->assertSame($info, $client->info);
}

public function testDeduplication()
{
$stream = $this->getClient()->getApi()->getStream('tester');
Expand Down

0 comments on commit 5dab15b

Please sign in to comment.