opt(announce): optimization announce data

This commit is contained in:
OldHawk
2017-12-23 02:05:28 +08:00
parent aae5efdd28
commit 56d6a4b67a
6 changed files with 107 additions and 9 deletions

View File

@@ -515,7 +515,7 @@ exports.getUserSeeding = function (req, res) {
Peer.find({
user: req.model._id,
peer_status: PEERSTATE_SEEDER,
last_announce_at: {$gt: Date.now() - announceConfig.announceInterval * 2}
last_announce_at: {$gt: Date.now() - announceConfig.announceInterval - 60 * 1000}
}).sort('-peer_uploaded')
.populate({
path: 'torrent',
@@ -544,7 +544,7 @@ exports.getUserLeeching = function (req, res) {
Peer.find({
user: req.model._id,
peer_status: PEERSTATE_LEECHER,
last_announce_at: {$gt: Date.now() - announceConfig.announceInterval * 2}
last_announce_at: {$gt: Date.now() - announceConfig.announceInterval - 60 * 1000}
}).sort('-peer_downloaded')
.populate({
path: 'torrent',