Увеличивает память ~ 20%, любой другой подход для решения этой проблемы. Я сомневаюсь, что setinterval удерживает весь дочерний процесс из G C
start();
function start() {
var processingCount = 0;
const concurrency = 10;
const pollingInterval = 1000;
setInterval(async () => {
if (processingCount <= concurrency) {
await startPolling();
}
}, pollingInterval); }
async function startPolling() {
try {
processingCount++;
await SQS.receiveMessage(params).promise();
//some long running operations
processingCount--;
} catch (error) {
//no need to throw error.
logger.error(error.message || error);
} }