seedlinux

find open source torrents and stats for people wishing to contribute bandwidth.
git clone git://git.beardyjay.co.uk/seedlinux
Log | Files | Refs | README | LICENSE

commit 75c5019dc591504b6079c4b2a85850bbc52d0735
parent fcd9e5498811a1e57a5b7aed4f36d90e1c9a99c4
Author: Jay Scott <jay@jayscott.co.uk>
Date:   Thu,  6 Jul 2017 21:00:39 +0100

performance improvement

Diffstat:
A.nvmrc | 1+
Mcontrollers/torrents_controller.js | 7+------
Mviews/layout.pug | 2+-
3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/.nvmrc b/.nvmrc @@ -0,0 +1 @@ +lts/* diff --git a/controllers/torrents_controller.js b/controllers/torrents_controller.js @@ -8,6 +8,7 @@ function getCount(callback) { Torrent.aggregate([ { $group: { _id: null, + count: { $sum: 1 }, total_seeders: { $sum: "$seeders" }, total_leechers: { $sum: "$leechers" } }} @@ -89,9 +90,6 @@ exports.download = function(req, res) { exports.index = function(req, res) { async.parallel( { - torrent_count: function(callback) { - Torrent.count(callback); - }, torrent_data: function(callback) { Torrent.find({}, callback); }, @@ -108,9 +106,6 @@ exports.index = function(req, res) { exports.detail = function(req, res) { async.parallel( { - torrent_count: function(callback) { - Torrent.count(callback); - }, torrent_data: function(callback) { Torrent.find({ hash: req.params.id }, callback); }, diff --git a/views/layout.pug b/views/layout.pug @@ -16,7 +16,7 @@ html .ui.container .ui.small.three.statistics .olive.statistic - .value= data.torrent_count + .value= data.torrent_seeds.count .label= "Total Torrents" .red.statistic .value= data.torrent_seeds.total_seeders