diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2016-07-06 19:59:01 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2016-07-06 19:59:01 +0200 |
commit | b359546358c39b839867ca920e10221979c65424 (patch) | |
tree | 03d9f57d9480ac4fba5d5f7ccf0f1311c92faafc /server/models/request.js | |
parent | 4fea95df04738290232bdc51696fb2233aa1a65e (diff) | |
download | PeerTube-b359546358c39b839867ca920e10221979c65424.tar.gz PeerTube-b359546358c39b839867ca920e10221979c65424.tar.zst PeerTube-b359546358c39b839867ca920e10221979c65424.zip |
Server: limit actions for each request between pods
Diffstat (limited to 'server/models/request.js')
-rw-r--r-- | server/models/request.js | 6 |
1 files changed, 3 insertions, 3 deletions
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) { | |||
102 | function makeRequests () { | 102 | function makeRequests () { |
103 | const self = this | 103 | const self = this |
104 | 104 | ||
105 | list.call(self, function (err, requests) { | 105 | listWithLimit.call(self, constants.REQUESTS_LIMIT, function (err, requests) { |
106 | if (err) { | 106 | if (err) { |
107 | logger.error('Cannot get the list of requests.', { err: err }) | 107 | logger.error('Cannot get the list of requests.', { err: err }) |
108 | return // Abort | 108 | return // Abort |
@@ -269,8 +269,8 @@ function updatePodsScore (goodPods, badPods) { | |||
269 | }) | 269 | }) |
270 | } | 270 | } |
271 | 271 | ||
272 | function list (callback) { | 272 | function listWithLimit (limit, callback) { |
273 | this.find({ }, { _id: 1, request: 1, to: 1 }).sort({ _id: 1 }).exec(callback) | 273 | this.find({ }, { _id: 1, request: 1, to: 1 }).sort({ _id: 1 }).limit(limit).exec(callback) |
274 | } | 274 | } |
275 | 275 | ||
276 | function removeAll (callback) { | 276 | function removeAll (callback) { |