ios: remove recursion in receiveMsgLoop (#3922)

* ios: remove recursion in receiveMsgLoop

* comment

---------

Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
This commit is contained in:
Alexander Bondarenko
2024-03-19 11:44:30 +00:00
committed by GitHub
co-authored by Evgeny Poberezkin
parent 8f04e13750
commit d835f9df3d
+5 -7
View File
@@ -1473,14 +1473,12 @@ class ChatReceiver {
}
func receiveMsgLoop() async {
// TODO use function that has timeout
if let msg = await chatRecvMsg() {
self._lastMsgTime = .now
await processReceivedMsg(msg)
}
if self.receiveMessages {
while self.receiveMessages {
if let msg = await chatRecvMsg() {
self._lastMsgTime = .now
await processReceivedMsg(msg)
}
_ = try? await Task.sleep(nanoseconds: 7_500_000)
await receiveMsgLoop()
}
}