function chunkedUpdateOfPromoCodes()

in lambdas/src/MembershipSub-Promotions-to-PromoCode-View-Lambda.js [66:77]


function chunkedUpdateOfPromoCodes(callback, TOUCHPOINT_BACKEND) {
    let i, j, temparray = [];
    const chunk = 25;

    promoCodesToUpdate = Object.keys(putRequestsByPromoCode);

    for (i = 0, j = promoCodesToUpdate.length; i < j; i += chunk) {
        temparray = promoCodesToUpdate.slice(i, i + chunk);
        if (!temparray || temparray.length === 0) continue;
        batchWriteRequestsForCodes(temparray, callback, TOUCHPOINT_BACKEND);
    }
}