From 567e63402b5ef7611d57bb53d49e4e0bab35832c Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Thu, 7 Dec 2017 14:15:46 +0000 Subject: [PATCH] fix: start polling stats on window show to avoid delay (#537) * fix: start polling stats on window show to avoid delay * remove trailing whitespace --- src/utils/stats-poller.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/utils/stats-poller.js b/src/utils/stats-poller.js index 6aecc1084..9f9fba670 100644 --- a/src/utils/stats-poller.js +++ b/src/utils/stats-poller.js @@ -9,15 +9,13 @@ export default class StatsPoller extends EventEmitter { this.shouldPoll = false this.statsCache = {} this.locationsCache = {} - - this._poller() } _poller () { const next = () => setTimeout(() => this._poller(), 1000) if (!this.shouldPoll) { - return next() + return } this.ipfs.swarm.peers() @@ -87,5 +85,6 @@ export default class StatsPoller extends EventEmitter { start () { this.shouldPoll = true + this._poller() } }