Move trigger out of while loop

This commit is contained in:
JC Brand 2021-06-18 10:21:03 +02:00
parent 42b15497fc
commit bb60f8cff4

View File

@ -11,6 +11,7 @@ export function pruneHistory (model) {
if (non_empty_messages.length > max_history) { if (non_empty_messages.length > max_history) {
while (non_empty_messages.length > max_history) { while (non_empty_messages.length > max_history) {
non_empty_messages.shift().destroy(); non_empty_messages.shift().destroy();
}
/** /**
* Triggered once the message history has been pruned, i.e. * Triggered once the message history has been pruned, i.e.
* once older messages have been removed to keep the * once older messages have been removed to keep the
@ -23,7 +24,6 @@ export function pruneHistory (model) {
} }
} }
} }
}
} }
export const debouncedPruneHistory = debounce(pruneHistory, 250); export const debouncedPruneHistory = debounce(pruneHistory, 250);