diff --git a/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js b/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js index baea3a9ec..3374cc680 100644 --- a/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js +++ b/src/commands/protocols/common/epoch-check/blockchain-epoch-check-command.js @@ -51,10 +51,15 @@ class BlockchainEpochCheckCommand extends Command { command.period, ); + const numberOfBlockchains = this.blockchainModuleManager.getImplementations().length(); + // We don't expect to have this many transactions in one epoch check window. // This is just to make sure we don't schedule too many commands and block the queue // TODO: find general solution for all commands scheduling blockchain transactions - totalTransactions = Math.min(totalTransactions, COMMAND_QUEUE_PARALLELISM * 0.3); + totalTransactions = Math.min( + totalTransactions, + Math.floor(COMMAND_QUEUE_PARALLELISM / numberOfBlockchains), + ); const transactionQueueLength = this.blockchainModuleManager.getTotalTransactionQueueLength(blockchain); diff --git a/src/constants/constants.js b/src/constants/constants.js index ea771a96f..e06bf467a 100644 --- a/src/constants/constants.js +++ b/src/constants/constants.js @@ -555,7 +555,7 @@ export const ARCHIVE_UPDATE_RESPONSES_FOLDER = 'update_responses'; * How many commands will run in parallel * @type {number} */ -export const COMMAND_QUEUE_PARALLELISM = 100; +export const COMMAND_QUEUE_PARALLELISM = 150; export const GET_LATEST_SERVICE_AGREEMENT_BATCH_SIZE = 50; diff --git a/src/modules/repository/implementation/sequelize/repositories/service-agreement-repository.js b/src/modules/repository/implementation/sequelize/repositories/service-agreement-repository.js index 062a6876e..813cf7be5 100644 --- a/src/modules/repository/implementation/sequelize/repositories/service-agreement-repository.js +++ b/src/modules/repository/implementation/sequelize/repositories/service-agreement-repository.js @@ -190,7 +190,7 @@ class ServiceAgreementRepository { ['scoreFunctionId', 'DESC'], [Sequelize.col('timeLeftInSubmitCommitWindow'), 'ASC'], ], - limit: 100, + limit: 500, raw: true, }); } @@ -249,7 +249,7 @@ class ServiceAgreementRepository { ['scoreFunctionId', 'DESC'], [Sequelize.col('timeLeftInSubmitProofWindow'), 'ASC'], ], - limit: 100, + limit: 500, raw: true, }); }