// Number of requests in parallel we can make
const REQUESTS_IN_PARALLEL = 10
+// How many requests we put in request (request scheduler)
+const REQUESTS_LIMIT = 10
+
// Number of requests to retry for replay requests module
const RETRY_REQUESTS = 5
PAGINATION_COUNT_DEFAULT: PAGINATION_COUNT_DEFAULT,
PODS_SCORE: PODS_SCORE,
REQUESTS_IN_PARALLEL: REQUESTS_IN_PARALLEL,
+ REQUESTS_LIMIT: REQUESTS_LIMIT,
RETRY_REQUESTS: RETRY_REQUESTS,
SEARCHABLE_COLUMNS: SEARCHABLE_COLUMNS,
SORTABLE_COLUMNS: SORTABLE_COLUMNS,
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
})
}
-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) {