mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-24 12:19:41 +00:00
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:
@@ -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);
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user