Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8549b3f

Browse filesBrowse files
Store millisecond timestamps as float instead of int to prevent int overflow issues on 32 bit based systems. Issue #43860
1 parent 6d688f6 commit 8549b3f
Copy full SHA for 8549b3f

File tree

2 files changed

+5
-5
lines changed
Filter options

2 files changed

+5
-5
lines changed

‎src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Transport/RedisExt/Connection.php
+4-4Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ public function reject(string $id): void
248248
}
249249
}
250250

251-
public function add(string $body, array $headers, int $delayInMs = 0): void
251+
public function add(string $body, array $headers, float $delayInMs = 0): void
252252
{
253253
if ($this->autoSetup) {
254254
$this->setup();
@@ -267,7 +267,7 @@ public function add(string $body, array $headers, int $delayInMs = 0): void
267267
throw new TransportException(json_last_error_msg());
268268
}
269269

270-
$score = $this->getCurrentTimeInMilliseconds() + $delayInMs;
270+
$score = $this->getCurrentTimeInMilliseconds() + (float) $delayInMs;
271271
$added = $this->connection->zadd($this->queue, ['NX'], $score, $message);
272272
} else {
273273
$message = json_encode([
@@ -316,9 +316,9 @@ public function setup(): void
316316
$this->autoSetup = false;
317317
}
318318

319-
private function getCurrentTimeInMilliseconds(): int
319+
private function getCurrentTimeInMilliseconds(): float
320320
{
321-
return (int) (microtime(true) * 1000);
321+
return microtime(true) * (float) 1000;
322322
}
323323

324324
public function cleanup(): void

‎src/Symfony/Component/Messenger/Transport/RedisExt/RedisSender.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Messenger/Transport/RedisExt/RedisSender.php
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function send(Envelope $envelope): Envelope
4242
$delayStamp = $envelope->last(DelayStamp::class);
4343
$delayInMs = null !== $delayStamp ? $delayStamp->getDelay() : 0;
4444

45-
$this->connection->add($encodedMessage['body'], $encodedMessage['headers'] ?? [], $delayInMs);
45+
$this->connection->add($encodedMessage['body'], $encodedMessage['headers'] ?? [], (float) $delayInMs);
4646

4747
return $envelope;
4848
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.