Don't explicitly sort messages.
Apparently not necessary, I was wrong about the race condition in 82fb263438
This commit is contained in:
parent
defea1631c
commit
297869c59f
|
@ -7,9 +7,6 @@ export function pruneHistory (model) {
|
||||||
const max_history = api.settings.get('prune_messages_above');
|
const max_history = api.settings.get('prune_messages_above');
|
||||||
if (max_history && typeof max_history === 'number') {
|
if (max_history && typeof max_history === 'number') {
|
||||||
if (model.messages.length > max_history) {
|
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));
|
const non_empty_messages = model.messages.filter((m) => !u.isEmptyMessage(m));
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user