aboutsummaryrefslogtreecommitdiffhomepage
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/initializers/constants.js4
-rw-r--r--server/models/request.js6
2 files changed, 7 insertions, 3 deletions
diff --git a/server/initializers/constants.js b/server/initializers/constants.js
index 55c555d04..32fe1645f 100644
--- a/server/initializers/constants.js
+++ b/server/initializers/constants.js
@@ -24,6 +24,9 @@ const PODS_SCORE = {
24// Number of requests in parallel we can make 24// Number of requests in parallel we can make
25const REQUESTS_IN_PARALLEL = 10 25const REQUESTS_IN_PARALLEL = 10
26 26
27// How many requests we put in request (request scheduler)
28const REQUESTS_LIMIT = 10
29
27// Number of requests to retry for replay requests module 30// Number of requests to retry for replay requests module
28const RETRY_REQUESTS = 5 31const RETRY_REQUESTS = 5
29 32
@@ -71,6 +74,7 @@ module.exports = {
71 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT, 74 PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,
72 PODS_SCORE: PODS_SCORE, 75 PODS_SCORE: PODS_SCORE,
73 REQUESTS_IN_PARALLEL: REQUESTS_IN_PARALLEL, 76 REQUESTS_IN_PARALLEL: REQUESTS_IN_PARALLEL,
77 REQUESTS_LIMIT: REQUESTS_LIMIT,
74 RETRY_REQUESTS: RETRY_REQUESTS, 78 RETRY_REQUESTS: RETRY_REQUESTS,
75 SEARCHABLE_COLUMNS: SEARCHABLE_COLUMNS, 79 SEARCHABLE_COLUMNS: SEARCHABLE_COLUMNS,
76 SORTABLE_COLUMNS: SORTABLE_COLUMNS, 80 SORTABLE_COLUMNS: SORTABLE_COLUMNS,
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) {
102function makeRequests () { 102function 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
272function list (callback) { 272function 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
276function removeAll (callback) { 276function removeAll (callback) {