Fix for offline-listeners overflooding total viewers

This commit is contained in:
Kasper Rynning-Tønnesen
2018-01-29 13:57:54 +01:00
parent a6e87696b8
commit 05980fe33c
7 changed files with 35 additions and 25 deletions

View File

@@ -10,7 +10,7 @@ router.route('/api/frontpages').get(function(req, res) {
db.collection("frontpage_lists").find({frontpage: true, count: {$gt: 0}}, function(err, docs) {
db.collection("connected_users").find({"_id": "total_users"}, function(err, tot) {
res.setHeader('Content-Type', 'application/json');
res.send(JSON.stringify({channels: docs, viewers: tot[0].total_users}));
res.send(JSON.stringify({channels: docs, viewers: tot[0].total_users.length}));
});
});
});