Debounce sync status. (#6572)

This commit is contained in:
Tomasz Drwięga 2017-09-26 13:05:41 +02:00 committed by Gav Wood
parent 6840df4c09
commit 59d946bf00
2 changed files with 33 additions and 926 deletions

948
js/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// 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 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 = () => {
return this._api.pubsub
.eth
@ -187,7 +193,7 @@ export default class Status {
return;
}
this._store.dispatch(statusCollection({ syncing }));
this._updateStatus({ syncing });
});
}
@ -198,6 +204,7 @@ export default class Status {
if (error || !netPeers) {
return;
}
this._store.dispatch(statusCollection({ netPeers }));
});
}