Skip to content

Commit 33c2490

Browse files
authored
Merge pull request #1161 from SimplyCodedSoftware/hotfix/dbal-delay
Fix dbal delivery delay to always keep integer value
2 parents 25601f3 + d4f8fac commit 33c2490

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

Diff for: pkg/dbal/DbalProducer.php

+3-12
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ class DbalProducer implements Producer
3535
*/
3636
private $context;
3737

38-
/**
39-
* @param DbalContext $context
40-
*/
4138
public function __construct(DbalContext $context)
4239
{
4340
$this->context = $context;
@@ -85,10 +82,7 @@ public function send(Destination $destination, Message $message): void
8582
$delay = $message->getDeliveryDelay();
8683
if ($delay) {
8784
if (!is_int($delay)) {
88-
throw new \LogicException(sprintf(
89-
'Delay must be integer but got: "%s"',
90-
is_object($delay) ? get_class($delay) : gettype($delay)
91-
));
85+
throw new \LogicException(sprintf('Delay must be integer but got: "%s"', is_object($delay) ? get_class($delay) : gettype($delay)));
9286
}
9387

9488
if ($delay <= 0) {
@@ -101,17 +95,14 @@ public function send(Destination $destination, Message $message): void
10195
$timeToLive = $message->getTimeToLive();
10296
if ($timeToLive) {
10397
if (!is_int($timeToLive)) {
104-
throw new \LogicException(sprintf(
105-
'TimeToLive must be integer but got: "%s"',
106-
is_object($timeToLive) ? get_class($timeToLive) : gettype($timeToLive)
107-
));
98+
throw new \LogicException(sprintf('TimeToLive must be integer but got: "%s"', is_object($timeToLive) ? get_class($timeToLive) : gettype($timeToLive)));
10899
}
109100

110101
if ($timeToLive <= 0) {
111102
throw new \LogicException(sprintf('TimeToLive must be positive integer but got: "%s"', $timeToLive));
112103
}
113104

114-
$dbalMessage['time_to_live'] = time() + (int) $timeToLive / 1000;
105+
$dbalMessage['time_to_live'] = time() + (int) ($timeToLive / 1000);
115106
}
116107

117108
try {

0 commit comments

Comments
 (0)