Fix debug log growing uncontrollably

Races between adding new log entries and fetching old ones can cause an
overage of more than one entry.

// FREEBIE
pull/749/head
lilia 9 years ago
parent a1743e3cc1
commit 6154dbb8db

@ -29,7 +29,7 @@
},
log: function(str) {
this.add({time: Date.now(), value: str}).save();
if (this.length > MAX_MESSAGES) {
while (this.length > MAX_MESSAGES) {
this.at(0).destroy();
}
},

Loading…
Cancel
Save