Backporting to beta (#4203)
* Minor typo to ensure it updates only when synced. (#4188) * Updater fixes (#4196) * Minor typo to ensure it updates only when synced. * Fix deadlock. * Skip unneeded arg in making list. * Allow auto-restart even when not running an update. * Fix trace. * Update update info on each loop. * Fix build. * Shutdown all sockets * Remove superfluous use. * Poll for upgrades as part of global status (long) (#4197) * Poll for upgrades as part of global status (long) * Fix path * Prevent duplicate incoming connections (#4180)
This commit is contained in:
committed by
Gav Wood
parent
f20db41169
commit
cf6d870b09
@@ -27,7 +27,7 @@ const STEP_UPDATING = 1;
|
||||
const STEP_COMPLETED = 2;
|
||||
const STEP_ERROR = 2;
|
||||
|
||||
const CHECK_INTERVAL = 1 * A_MINUTE;
|
||||
let instance = null;
|
||||
|
||||
export default class Store {
|
||||
@observable available = null;
|
||||
@@ -44,8 +44,6 @@ export default class Store {
|
||||
|
||||
this.loadStorage();
|
||||
this.checkUpgrade();
|
||||
|
||||
setInterval(this.checkUpgrade, CHECK_INTERVAL);
|
||||
}
|
||||
|
||||
@computed get isVisible () {
|
||||
@@ -119,10 +117,10 @@ export default class Store {
|
||||
|
||||
checkUpgrade = () => {
|
||||
if (!this._api) {
|
||||
return;
|
||||
return Promise.resolve(false);
|
||||
}
|
||||
|
||||
Promise
|
||||
return Promise
|
||||
.all([
|
||||
this._api.parity.upgradeReady(),
|
||||
this._api.parity.consensusCapability(),
|
||||
@@ -134,11 +132,23 @@ export default class Store {
|
||||
}
|
||||
|
||||
this.setVersions(available, version, consensusCapability);
|
||||
|
||||
return true;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.warn('checkUpgrade', error);
|
||||
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
static get (api) {
|
||||
if (!instance) {
|
||||
instance = new Store(api);
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
export {
|
||||
|
||||
Reference in New Issue
Block a user