Skip to content

[Messenger] Store dates in UTC when using Doctrine #50287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public static function buildConfiguration(#[\SensitiveParameter] string $dsn, ar
*/
public function send(string $body, array $headers, int $delay = 0): string
{
$now = new \DateTimeImmutable();
$now = new \DateTimeImmutable('UTC');
$availableAt = $now->modify(sprintf('+%d seconds', $delay / 1000));

$queryBuilder = $this->driverConnection->createQueryBuilder()
Expand Down Expand Up @@ -221,7 +221,7 @@ public function get(): ?array
->update($this->configuration['table_name'])
->set('delivered_at', '?')
->where('id = ?');
$now = new \DateTimeImmutable();
$now = new \DateTimeImmutable('UTC');
$this->executeStatement($queryBuilder->getSQL(), [
$now,
$doctrineEnvelope['id'],
Expand Down Expand Up @@ -342,7 +342,7 @@ public function getExtraSetupSqlForTable(Table $createdTable): array

private function createAvailableMessagesQueryBuilder(): QueryBuilder
{
$now = new \DateTimeImmutable();
$now = new \DateTimeImmutable('UTC');
$redeliverLimit = $now->modify(sprintf('-%d seconds', $this->configuration['redeliver_timeout']));

return $this->createQueryBuilder()
Expand Down