Merge pull request #11241 from annando/timing

Workaround for timing problems / Avoid a notice in the scheduled posts
This commit is contained in:
Hypolite Petovan 2022-02-15 10:20:04 -05:00 committed by GitHub
commit f329d5c067
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -71,7 +71,7 @@ class ScheduledStatus extends BaseDataTransferObject
'media_ids' => $media_ids, 'media_ids' => $media_ids,
'sensitive' => null, 'sensitive' => null,
'spoiler_text' => $parameters['item']['title'] ?? '', 'spoiler_text' => $parameters['item']['title'] ?? '',
'visibility' => $visibility[$parameters['item']['private']], 'visibility' => $visibility[$parameters['item']['private'] ?? 1],
'scheduled_at' => $this->scheduled_at, 'scheduled_at' => $this->scheduled_at,
'poll' => null, 'poll' => null,
'idempotency' => null, 'idempotency' => null,

View File

@ -627,7 +627,8 @@ class HTTPSignature
if (!empty($created)) { if (!empty($created)) {
$current = time(); $current = time();
if ($created > $current) { // Calculate with a grace period of 60 seconds to avoid slight time differences between the servers
if (($created - 60) > $current) {
Logger::notice('Signature created in the future', ['created' => date(DateTimeFormat::MYSQL, $created), 'expired' => date(DateTimeFormat::MYSQL, $expired), 'current' => date(DateTimeFormat::MYSQL, $current)]); Logger::notice('Signature created in the future', ['created' => date(DateTimeFormat::MYSQL, $created), 'expired' => date(DateTimeFormat::MYSQL, $expired), 'current' => date(DateTimeFormat::MYSQL, $current)]);
return false; return false;
} }