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 0681a8a

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 3ae3244 commit 0681a8a
Copy full SHA for 0681a8a

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
@@ -233,7 +233,7 @@ public function reject(string $id): void
233233
}
234234
}
235235

236-
public function add(string $body, array $headers, int $delayInMs = 0): void
236+
public function add(string $body, array $headers, float $delayInMs = 0): void
237237
{
238238
if ($this->autoSetup) {
239239
$this->setup();
@@ -252,7 +252,7 @@ public function add(string $body, array $headers, int $delayInMs = 0): void
252252
throw new TransportException(json_last_error_msg());
253253
}
254254

255-
$score = (int) ($this->getCurrentTimeInMilliseconds() + $delayInMs);
255+
$score = $this->getCurrentTimeInMilliseconds() + (float) $delayInMs;
256256
$added = $this->connection->zadd($this->queue, ['NX'], $score, $message);
257257
} else {
258258
$message = json_encode([
@@ -301,9 +301,9 @@ public function setup(): void
301301
$this->autoSetup = false;
302302
}
303303

304-
private function getCurrentTimeInMilliseconds(): int
304+
private function getCurrentTimeInMilliseconds(): float
305305
{
306-
return (int) (microtime(true) * 1000);
306+
return microtime(true) * (float) 1000;
307307
}
308308

309309
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.