performance improvement - seedlinux - Torrent indexing tool opensource torrents with share ratio's etc.
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
---
(DIR) commit dcfc033b4a8c665c42a98e419c2da3c2cafe2e2f
(DIR) parent 44df8657953f43f9514a953ddc9225c3904b4be1
(HTM) Author: Jay Scott <jay@jayscott.co.uk>
Date: Thu, 6 Jul 2017 21:00:39 +0100
performance improvement
Diffstat:
A .nvmrc | 1 +
M controllers/torrents_controller.js | 7 +------
M views/layout.pug | 2 +-
3 files changed, 3 insertions(+), 7 deletions(-)
---
(DIR) diff --git a/.nvmrc b/.nvmrc
@@ -0,0 +1 @@
+lts/*
(DIR) 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);
},
(DIR) 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