This is the function that I'm invoking: ``` export const sendBatchQueueMessage = ({ batch, env,
This is the function that I'm invoking:
export const sendBatchQueueMessage = ({
batch,
env,
}: SendBatchQueueMessage) => {
const ch = chunk(batch, 80);
return Promise.all(
ch.map((c) => {
return env.PROCESS_QUEUE.sendBatch(
c.map((body) => ({ body: body.message, contentType: 'json' })),
);
}),
);
};chunk here is lodash's chunk function, to break messages into groupsPromise.all p-map (https://github.com/sindresorhus/p-map) might help to keep the concurrency level down - you can only have 6 simultaneous connections open.send or sendBatch counts as one) . An invocation is each call to queue or fetch.fetch that is finalised at the end of the queue() handlerfetch, then all the requests within the queue invocation must be < 1000, or else the log message would never make itQueue send failed: Service Temporarily Unavailablesend(“foo”)

"Queue send failed: Service Temporarily Unavailable"3037173
chunklodashPromise.allp-mapexport const sendQueueMessage = ({ message, env }: SendQueueMessage) => {
return env.PROCESS_QUEUE.send(message, { contentType: 'json' });
};sendsendBatchqueuequeuequeue()return handleMessages(batch, { ...env, logger }).finally(() =>
tracer.finalizeQueueEvent({ batch }),
);Queue send failed: Service Temporarily Unavailable "Queue sendBatch failed: Service Temporarily Unavailablesend(“foo”) env.logger.info('Sending foo');
env.PROCESS_QUEUE.send('FOO')
.then(() => env.logger.info('sent foo'))
.catch((e) => env.logger.error('failed to send foo', e)); "Queue send failed: Service Temporarily Unavailable"3037173