From 09fb5262351e4b3a7fde66b3a406b9af3e68ea6e Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Mon, 9 Jan 2017 19:43:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B1=D0=BE=D0=BB=D0=B5=D0=B5=20=D1=87=D0=B8?= =?UTF-8?q?=D1=82=D0=B0=D0=B1=D0=B5=D0=BB=D1=8C=D0=BD=D1=8B=D0=B9=20=D0=B2?= =?UTF-8?q?=D0=B0=D1=80=D0=B8=D0=B0=D0=BD=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/recent-torrents.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/recent-torrents.js b/src/recent-torrents.js index a9815a9..36369c1 100644 --- a/src/recent-torrents.js +++ b/src/recent-torrents.js @@ -168,6 +168,7 @@ export default class RecentTorrents extends Component { this.torrents = []; this.displayQueue = []; this.displayQueueAssoc = {}; + this.maxDisplaySize = 1000; this.state = { pause: false } } componentDidMount() { @@ -187,9 +188,7 @@ export default class RecentTorrents extends Component { return; } - let speed = 850 - (((this.displayQueue.length / 100)|0) * 100) - if(speed < 10) - speed = 10; + const speed = 850; if(this.state.pause) { setTimeout(this.displayNewTorrent, speed); @@ -209,9 +208,11 @@ export default class RecentTorrents extends Component { this.displayNewTorrent(); }); this.newTorrentFunc = (torrent) => { - this.displayQueue.push(torrent); - this.displayQueueAssoc[torrent.hash] = torrent; - this.forceUpdate(); + if(this.displayQueue.length < this.maxDisplaySize) { + this.displayQueue.push(torrent); + this.displayQueueAssoc[torrent.hash] = torrent; + this.forceUpdate(); + } }; window.torrentSocket.on('newTorrent', this.newTorrentFunc);