diff --git a/Library/Network/CommandClient.swift b/Library/Network/CommandClient.swift index bf235f7..02b76c0 100644 --- a/Library/Network/CommandClient.swift +++ b/Library/Network/CommandClient.swift @@ -171,12 +171,14 @@ public class CommandClient: ObservableObject { return } DispatchQueue.main.async { [self] in - if commandClient.logList.count >= commandClient.logMaxLines { - commandClient.logList.removeFirst() - } + var newLogList = commandClient.logList while messageList.hasNext() { - commandClient.logList.append(messageList.next()) + newLogList.append(messageList.next()) } + if newLogList.count >= commandClient.logMaxLines { + newLogList.removeSubrange(0...newLogList.count-commandClient.logMaxLines) + } + commandClient.logList = newLogList } }