1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-27 09:34:38 +01:00

Fix: async database upgrade

This commit is contained in:
Alexander Pankratov 2023-07-10 00:27:24 +02:00
parent c57a63b365
commit 7cbeb4c9cb

View File

@ -957,12 +957,20 @@ final class MTProto implements TLCallback, LoggerGetter
}
}
foreach ($this->chats as $id => $chat) {
$id = (int) $id;
if (!($chat['min'] ?? false)) {
$this->minDatabase->clearPeer($id);
async(function() {
$counter = 0;
foreach ($this->chats as $id => $chat) {
$id = (int) $id;
$counter ++;
if ($counter % 1000 === 0) {
$this->logger->logger("Upgrading chats: $counter", Logger::WARNING);
}
if (!($chat['min'] ?? false)) {
$this->minDatabase->clearPeer($id);
}
}
}
});
}
/**
* Post-deserialization initialization function.