Browse Source

Don't explicitly sort messages.

Apparently not necessary, I was wrong about the race condition in 82fb263438f77745e3d958c78502df202cb9fffb
JC Brand 3 years ago
parent
commit
297869c59f
1 changed files with 0 additions and 3 deletions
  1. 0 3
      src/headless/shared/chat/utils.js

+ 0 - 3
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) {