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
This commit is contained in:
parent
a1743e3cc1
commit
6154dbb8db
1 changed files with 1 additions and 1 deletions
|
@ -29,7 +29,7 @@
|
||||||
},
|
},
|
||||||
log: function(str) {
|
log: function(str) {
|
||||||
this.add({time: Date.now(), value: str}).save();
|
this.add({time: Date.now(), value: str}).save();
|
||||||
if (this.length > MAX_MESSAGES) {
|
while (this.length > MAX_MESSAGES) {
|
||||||
this.at(0).destroy();
|
this.at(0).destroy();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue