Don't explicitly sort messages.

Apparently not necessary, I was wrong about the race condition in 82fb263438
This commit is contained in:
JC Brand 2022-03-15 21:16:33 +01:00
parent defea1631c
commit 297869c59f

View File

@ -7,9 +7,6 @@ export function pruneHistory (model) {
const max_history = api.settings.get('prune_messages_above');
if (max_history && typeof max_history === 'number') {
if (model.messages.length > max_history) {
model.messages.sort(); // Explicitly call sort() to avoid race-conditions
const non_empty_messages = model.messages.filter((m) => !u.isEmptyMessage(m));
if (non_empty_messages.length > max_history) {
while (non_empty_messages.length > max_history) {