From 6154dbb8db8192ae9b403ac977821c93e3f9b33c Mon Sep 17 00:00:00 2001 From: lilia Date: Fri, 12 Feb 2016 18:34:06 -0800 Subject: [PATCH] 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 --- js/debugLog.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/debugLog.js b/js/debugLog.js index 1cbcec5a..c6e0f7fa 100644 --- a/js/debugLog.js +++ b/js/debugLog.js @@ -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(); } },