mirror of
https://github.com/Foundry376/Mailspring.git
synced 2024-09-21 07:46:06 +08:00
Reduce offline battery usage by… updating labels less often
This commit is contained in:
parent
62aab65db4
commit
e454f9d608
|
@ -62,6 +62,15 @@ class OnlineStatusStore extends MailspringStore {
|
||||||
if (this._countdownSeconds === 0) {
|
if (this._countdownSeconds === 0) {
|
||||||
this._checkOnlineStatus();
|
this._checkOnlineStatus();
|
||||||
} else {
|
} else {
|
||||||
|
// if the countdown is greater than 10 seconds we only update every 5
|
||||||
|
// seconds just for a tiny, tiny offline performance improvement
|
||||||
|
// 45, 30, 15, 10, 9, 8, 7...
|
||||||
|
if (this._countdownSeconds > 30 && this._countdownSeconds % 15 !== 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (this._countdownSeconds > 10 && this._countdownSeconds % 5 !== 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
this.trigger({ onlineDidChange: false, countdownDidChange: true });
|
this.trigger({ onlineDidChange: false, countdownDidChange: true });
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
Loading…
Reference in a new issue