From 9bbb72f12bc8496a87761ae47df2fc1732bdfcd7 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Wed, 13 Dec 2023 19:57:09 +0100 Subject: [PATCH] Simplify gap handling after simplification of actor library --- src/Loop/Update/FeedLoop.php | 5 ++--- src/Loop/Update/SeqLoop.php | 7 ++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/Loop/Update/FeedLoop.php b/src/Loop/Update/FeedLoop.php index 0b340cb6c..760079597 100644 --- a/src/Loop/Update/FeedLoop.php +++ b/src/Loop/Update/FeedLoop.php @@ -112,7 +112,7 @@ final class FeedLoop extends Loop continue; } if (isset($update['pts'], $update['pts_count'])) { - $logger = function ($msg) use ($update): void { + $logger = function (string $msg) use ($update): void { $pts_count = $update['pts_count']; $mid = $update['message']['id'] ?? '-'; $mypts = $this->state->pts(); @@ -128,8 +128,7 @@ final class FeedLoop extends Loop $logger('PTS hole'); $this->updater->setLimit($this->state->pts() + $result); $this->updater->resume(); - $updates = array_merge($this->incomingUpdates, $updates); - $this->incomingUpdates = []; + // Drop current update, it will be recovered anyway while filling the gap continue; } if (isset($update['message']['id'], $update['message']['peer_id']) && !\in_array($update['_'], ['updateEditMessage', 'updateEditChannelMessage', 'updateMessageID'], true)) { diff --git a/src/Loop/Update/SeqLoop.php b/src/Loop/Update/SeqLoop.php index 101804047..42d4be50f 100644 --- a/src/Loop/Update/SeqLoop.php +++ b/src/Loop/Update/SeqLoop.php @@ -94,11 +94,8 @@ final class SeqLoop extends Loop $result = $this->state->checkSeq($seq_start); if ($result > 0) { $this->API->logger('Seq hole. seq_start: '.$seq_start.' != cur seq: '.($this->state->seq() + 1), Logger::ERROR); - delay(1); - if (!$this->incomingUpdates) { - $this->API->updaters[UpdateLoop::GENERIC]->resume(); - } - $this->incomingUpdates = array_merge($this->incomingUpdates, [$update], $updates); + $this->API->updaters[UpdateLoop::GENERIC]->resume(); + // Drop current update, it will be recovered anyway while filling the gap continue; } if ($result < 0) {