Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
log.info(`Checking ${arn}`);
if (r.status === 'running') {
// check if it the execution has passed the five hours limit
const now = Date.now();
const late = (now - timestamp) > 18000000;
if (late) {
error = {
Error: 'Stopped By Cumulus',
Cause: 'Execution was stopped by Cumulus because it did not finish in 5 hours.'
};
await StepFunction.stop(
arn,
error.Cause,
error.Error
);
await partialRecordUpdate(esClient, arn, 'execution', { status: 'failed', error });
await updateGranulesAndPdrs(esClient, url, error);
}
} else {
if (output.error) {
input.exception = output.error;
input.meta.status = 'failed';
await handlePayload(output);
return;
}