From 297869c59f9250c45beea6a9e80864b0b4169f82 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Tue, 15 Mar 2022 21:16:33 +0100 Subject: [PATCH] Don't explicitly sort messages. Apparently not necessary, I was wrong about the race condition in 82fb263438f77745e3d958c78502df202cb9fffb --- src/headless/shared/chat/utils.js | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/headless/shared/chat/utils.js b/src/headless/shared/chat/utils.js index a56de8fed..3019d2bcc 100644 --- a/src/headless/shared/chat/utils.js +++ b/src/headless/shared/chat/utils.js @@ -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) {