updateBatchStatus()

in batchOperations.js [304:364]


                    updateBatchStatus(s3Prefix, batchId, STATUS_REPROCESSING, preconditionStatus, "Reprocessing initiated by reprocessBatch request", function (err) {
                        if (err) {
                            if (err.code === conditionCheckFailed) {
                                callback("Batch to be reprocessed must either be Locked or Error status")
                            } else {
                                callback(err);
                            }
                        } else {
                            // create a list of files which filters out the omittedFiles
                            var processFiles = [];
                            if (omitFiles) {
                                if (data.entries) {
                                    data.entries.SS.map(function (item) {
                                        if (omitFiles.indexOf(item) === -1) {
                                            // file is not in the omit list, so add it to the process list
                                            processFiles.push(item);
                                        }
                                    });
                                }

                                if (data.entryMap) {
                                    data.entryMap.L.map(function (item) {
                                        if (omitFiles.indexOf(item.file.S) === -1) {
                                            // file is not in the omit list, so add it to the process list
                                            processFiles.push(item.M.file.S);
                                        }
                                    });
                                }
                            } else {
                                // add pre 2.7.9 StringSet entries
                                if (data.entries) {
                                    processFiles = data.entries.SS;
                                }

                                // add 2.7.0 and forward entryMap list
                                if (data.entryMap) {
                                    data.entryMap.L.map(function (item) {
                                        processFiles.push(item.M.file.S);
                                    });
                                }
                            }

                            // for each of the current file entries, execute the processedFiles reprocess method
                            var fileReprocessor = common.reprocessFile.bind(undefined, dynamoDB, s3, region);

                            async.map(processFiles, fileReprocessor, function (err) {
                                if (err) {
                                    callback(err);
                                } else {
                                    var preconditionStatus = [{
                                        S: STATUS_REPROCESSING
                                    }];

                                    // files have been reprocessed, so now set the batch status to reprocessed to indicate that it is closed
                                    updateBatchStatus(s3Prefix, batchId, 'reprocessed', preconditionStatus, undefined, function (err) {
                                        callback(err);
                                    });
                                }
                            });
                        }
                    });