mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-02 06:11:32 +01:00
Use two interations instead of while loop for trimming log
FREEBIE
This commit is contained in:
@@ -33,8 +33,14 @@
|
||||
entry.save();
|
||||
}
|
||||
|
||||
while (this.length > MAX_MESSAGES) {
|
||||
this.at(0).destroy();
|
||||
// Two separate iterations to deal with removal eventing wonkiness
|
||||
var toDrop = this.length - MAX_MESSAGES;
|
||||
var entries = [];
|
||||
for (var i = 0; i < toDrop; i += 1) {
|
||||
entries.push(this.at(i));
|
||||
}
|
||||
for (var j = 0, max = entries.length; j < max; j += 1) {
|
||||
entries[i].destroy();
|
||||
}
|
||||
},
|
||||
print: function() {
|
||||
|
||||
Reference in New Issue
Block a user