From b359546358c39b839867ca920e10221979c65424 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 6 Jul 2016 19:59:01 +0200 Subject: Server: limit actions for each request between pods --- server/models/request.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'server/models') diff --git a/server/models/request.js b/server/models/request.js index 7fdf5bd31..248ab3303 100644 --- a/server/models/request.js +++ b/server/models/request.js @@ -102,7 +102,7 @@ function makeRequest (toPod, requestsToMake, callback) { function makeRequests () { const self = this - list.call(self, function (err, requests) { + listWithLimit.call(self, constants.REQUESTS_LIMIT, function (err, requests) { if (err) { logger.error('Cannot get the list of requests.', { err: err }) return // Abort @@ -269,8 +269,8 @@ function updatePodsScore (goodPods, badPods) { }) } -function list (callback) { - this.find({ }, { _id: 1, request: 1, to: 1 }).sort({ _id: 1 }).exec(callback) +function listWithLimit (limit, callback) { + this.find({ }, { _id: 1, request: 1, to: 1 }).sort({ _id: 1 }).limit(limit).exec(callback) } function removeAll (callback) { -- cgit v1.2.3