Fix a bug that causes 100% CPU load in timestamp_view.js
When `millis_since` becomes larger than one week, `delay` becomes negative and is set to Zero. This causes an infinite loop and therefore 100% CPU usage (single thread). // FREEBIE
This commit is contained in:
parent
f1335d65f5
commit
9b390baea0
1 changed files with 8 additions and 1 deletions
|
@ -34,10 +34,17 @@
|
|||
} else { // more than a week ago
|
||||
// Day of week + time
|
||||
delay = 7 * 24 * 60 * 60 * 1000 - millis_since;
|
||||
|
||||
if (delay < -(60 * 1000)) {
|
||||
// more than one week and one minute ago
|
||||
// don't do any further updates as the displayed timestamp
|
||||
// won't change any more
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (delay) {
|
||||
if (delay < 0) { delay = 0; }
|
||||
if (delay < 0) { delay = 1000; }
|
||||
this.timeout = setTimeout(this.update.bind(this), delay);
|
||||
}
|
||||
},
|
||||
|
|
Loading…
Reference in a new issue