Skip to content

Commit

Permalink
Bug/33659 pin generation queue messages are too large (#1244)
Browse files Browse the repository at this point in the history
* [admin] add config.prepareCheckMessageBatchSize

* [admin] FIX: prepare check message size too large

Allow a configurable number of messages to be sent across to the prepare-check queue to work around the fact that
20 messages was too large.

* [admin] add logging
  • Loading branch information
jon-shipley authored and GuyHarwood committed Jun 10, 2019
1 parent 1f96cee commit 7b0c763
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions admin/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ module.exports = {
OVERRIDE_AVAILABILITY_MIDDLEWARE: false,
OverridePinExpiry: process.env.hasOwnProperty('OVERRIDE_PIN_EXPIRY') ? toBool(process.env.OVERRIDE_PIN_EXPIRY) : false,
PORT: process.env.PORT || '3001',
prepareCheckMessageBatchSize: process.env.hasOwnProperty('PREPARE_CHECK_MESSAGE_BATCH_SIZE') ? parseInt(process.env.PREPARE_CHECK_MESSAGE_BATCH_SIZE, 10) : 5,
PUPIL_APP_URL: process.env.PUPIL_APP_URL,
PupilAppUseCompression: process.env.hasOwnProperty('PUPIL_APP_USE_COMPRESSION') ? toBool(process.env.PUPIL_APP_USE_COMPRESSION) : true,
RESTART_MAX_ATTEMPTS: 2,
Expand Down
7 changes: 6 additions & 1 deletion admin/services/check-start.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,14 @@ checkStartService.prepareCheck2 = async function (

// Send batch messages each containing the up to 20 prepare check messages. This avoids hitting the max message size
// for Azure Queues of 64Kb
const batches = R.splitEvery(20, prepareCheckQueueMessages)
logger.info(`check start service: prepare check batch size is ${config.prepareCheckMessageBatchSize}`)
const batches = R.splitEvery(config.prepareCheckMessageBatchSize, prepareCheckQueueMessages)
let batchCount = 1
let totalBatches = batches.length
for (let batch of batches) {
logger.info(`check start service: sending batch ${batchCount} of ${totalBatches} for school ${schoolId}`)
await azureQueueService.addMessageAsync(prepareCheckQueueName, { version: 2, messages: batch })
batchCount += 1
}

// Store the `config` section from the preparedCheckMessages into the DB
Expand Down

0 comments on commit 7b0c763

Please sign in to comment.