diff --git a/CountItems/masterProcess.js b/CountItems/masterProcess.js index 2605b4f1..f3d232fd 100644 --- a/CountItems/masterProcess.js +++ b/CountItems/masterProcess.js @@ -1,7 +1,6 @@ const werelogs = require('werelogs'); const { network } = require('arsenal'); const { reshapeExceptionError } = require('arsenal').errorUtils; -const { threshold, frequency } = require('../utils/constants'); const S3UtilsMongoClient = require('../utils/S3UtilsMongoClient'); const CountMaster = require('./CountMaster'); @@ -23,6 +22,14 @@ const loggerConfig = { werelogs.configure(loggerConfig); const log = new werelogs.Logger('S3Utils::CountItems::Master'); +const frequency = process.env.PROMETHEUS_POLLING_FREQUENCY && !Number.isNaN(process.env.PROMETHEUS_POLLING_FREQUENCY) + ? Number.parseInt(process.env.PROMETHEUS_POLLING_FREQUENCY, 10) + : 30; + +const threshold = process.env.PROMETHEUS_POLLING_THRESHOLD && !Number.isNaN(process.env.PROMETHEUS_POLLING_THRESHOLD) + ? Number.parseInt(process.env.PROMETHEUS_POLLING_THRESHOLD, 10) + : 5; + const numWorkers = process.env.NUM_WORKERS && !Number.isNaN(process.env.NUM_WORKERS) ? Number.parseInt(process.env.NUM_WORKERS, 10) : 4; diff --git a/utils/constants.js b/utils/constants.js index fadf710a..17c0605e 100644 --- a/utils/constants.js +++ b/utils/constants.js @@ -1,5 +1,3 @@ module.exports = { MaxParallelLimit: 10, - frequency: 30, - threshold: 5, };