mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Merge pull request #1817 from Rxflex/patch-1
limit rawLogs to max number of lines by trimming old entries
This commit is contained in:
commit
7e365e1947
@ -140,7 +140,14 @@ export const DockerLogsId: React.FC<Props> = ({
|
||||
|
||||
ws.onmessage = (e) => {
|
||||
if (!isCurrentConnection) return;
|
||||
setRawLogs((prev) => prev + e.data);
|
||||
setRawLogs((prev) => {
|
||||
const updated = prev + e.data;
|
||||
const splitLines = updated.split("\n");
|
||||
if (splitLines.length > lines) {
|
||||
return splitLines.slice(-lines).join("\n");
|
||||
}
|
||||
return updated;
|
||||
});
|
||||
setIsLoading(false);
|
||||
if (noDataTimeout) clearTimeout(noDataTimeout);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user