Refactoring: Move delay parameter as last in Producer::dpub

This commit is contained in:
2021-01-25 03:27:04 +03:00
parent d9bf2a4437
commit da4331127b
3 changed files with 5 additions and 5 deletions

View File

@ -44,7 +44,7 @@ Usage
### Publish
```php
use Nsq\Producer;
use Nsq\Producer;use function Amp\Promise\timeout;
$producer = new Producer(address: 'tcp://nsqd:4150');
@ -58,7 +58,7 @@ $producer->mpub('topic', [
]);
// Publish a deferred message to a topic
$producer->dpub('topic', 5000, 'Deferred message');
$producer->dpub('topic', 'Deferred message', delay: 5000);
```
### Subscription

View File

@ -37,8 +37,8 @@ final class Producer extends Connection
/**
* @psalm-suppress PossiblyFalseOperand
*/
public function dpub(string $topic, int $deferTime, string $body): void
public function dpub(string $topic, string $body, int $delay): void
{
$this->command('DPUB', [$topic, $deferTime], $body)->response()->okOrFail();
$this->command('DPUB', [$topic, $delay], $body)->response()->okOrFail();
}
}

View File

@ -63,7 +63,7 @@ final class NsqTest extends TestCase
self::assertSame('Second mpub message.', $message->body);
$message->finish();
$producer->dpub(__FUNCTION__, 2000, 'Deferred message.');
$producer->dpub(__FUNCTION__, 'Deferred message.', 2000);
$generator->next();
/** @var null|Message $message */