Debounce sync status. (#6572)
This commit is contained in:
parent
6840df4c09
commit
59d946bf00
948
js/package-lock.json
generated
948
js/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -14,7 +14,7 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
// along with Parity. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
import { isEqual } from 'lodash';
|
import { isEqual, debounce } from 'lodash';
|
||||||
|
|
||||||
import { LOG_KEYS, getLogger } from '~/config';
|
import { LOG_KEYS, getLogger } from '~/config';
|
||||||
import UpgradeStore from '~/modals/UpgradeParity/store';
|
import UpgradeStore from '~/modals/UpgradeParity/store';
|
||||||
@ -179,6 +179,12 @@ export default class Status {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_updateStatus = debounce(status => {
|
||||||
|
this._store.dispatch(statusCollection(status));
|
||||||
|
}, 2500, {
|
||||||
|
maxWait: 5000
|
||||||
|
});
|
||||||
|
|
||||||
_subscribeEthSyncing = () => {
|
_subscribeEthSyncing = () => {
|
||||||
return this._api.pubsub
|
return this._api.pubsub
|
||||||
.eth
|
.eth
|
||||||
@ -187,7 +193,7 @@ export default class Status {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._store.dispatch(statusCollection({ syncing }));
|
this._updateStatus({ syncing });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -198,6 +204,7 @@ export default class Status {
|
|||||||
if (error || !netPeers) {
|
if (error || !netPeers) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this._store.dispatch(statusCollection({ netPeers }));
|
this._store.dispatch(statusCollection({ netPeers }));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user