From 884f93d799698119edda4d00a27b259f6acf7aa6 Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Sat, 31 Mar 2018 04:32:15 +0300 Subject: [PATCH] refactor(faketors): removed old fake torrents code --- src/background/spider.js | 42 ---------------------------------------- 1 file changed, 42 deletions(-) diff --git a/src/background/spider.js b/src/background/spider.js index 9199b0c..0fabbf4 100644 --- a/src/background/spider.js +++ b/src/background/spider.js @@ -24,7 +24,6 @@ let rootPath = os.platform() === 'win32' ? 'c:' : '/'; const _debug = require('debug') const cleanupDebug = _debug('main:cleanup'); const balanceDebug = _debug('main:balance'); -const fakeTorrentsDebug = _debug('main:fakeTorrents'); const quotaDebug = _debug('main:quota'); const checkInternet = require('./checkInternet') @@ -701,53 +700,12 @@ API({ insertTorrentToDB }) -let fakeTorrents = []; -function showFakeTorrentsPage(page) -{ - mysqlSingle.query('SELECT * FROM torrents LIMIT ?, 100', [page], function(err, torrents) { - if(!torrents) - return; - - torrents.forEach((torrent, index) => { - const fk = fakeTorrents.push(setTimeout(() => { - delete fakeTorrents[fk-1]; - send('newTorrent', baseRowData(torrent)); - updateTorrentTrackers(torrent.hash); - fakeTorrentsDebug('fake torrent', torrents.name, 'index, page:', index, page); - }, 700 * index)) - }) - - const fk = fakeTorrents.push(setTimeout(()=>{ - delete fakeTorrents[fk-1]; - showFakeTorrentsPage(torrents.length > 0 ? page + torrents.length : 0) - }, 700 * torrents.length)) - }); -} - -function showFakeTorrents() -{ - fakeTorrentsDebug('showing fake torrents'); - hideFakeTorrents() - showFakeTorrentsPage(0); -} - -function hideFakeTorrents() -{ - fakeTorrents.forEach((fk) => { - clearTimeout(fk) - }) - fakeTorrents = [] - fakeTorrentsDebug('hidding fake torrents'); -} - if(config.indexer) { spider.listen(config.spiderPort) if(config.p2p) { spider.announceHashes = [crypto.createHash('sha1').update('degrats-v1').digest()] } -} else { -// showFakeTorrents(); } if(config.cleanup && config.indexer)