diff --git a/examples/magnaluna b/examples/magnaluna index fd1839fb9..406249e2a 160000 --- a/examples/magnaluna +++ b/examples/magnaluna @@ -1 +1 @@ -Subproject commit fd1839fb9d22886b2775af8d049a0bc989885671 +Subproject commit 406249e2a31dbe1f04686a29da1167b61d720fe3 diff --git a/src/MTProtoTools/PeerDatabase.php b/src/MTProtoTools/PeerDatabase.php index c484c34f5..af86c59c5 100644 --- a/src/MTProtoTools/PeerDatabase.php +++ b/src/MTProtoTools/PeerDatabase.php @@ -139,9 +139,12 @@ final class PeerDatabase implements TLCallback $this->usernames->clear(); } - foreach ($this->pendingDb as $key => $_) { - EventLoop::queue($key < 0 ? $this->processChat(...) : $this->processUser(...), $key); - } + EventLoop::queue(function () { + $this->API->waitForInit(); + foreach ($this->pendingDb as $key => $_) { + EventLoop::queue($key < 0 ? $this->processChat(...) : $this->processUser(...), $key); + } + }); } public function importLegacy(MemoryArray $chats, MemoryArray $fullChats): void {