stream-consumer.js
function calculateTimeoutMs(timeoutAtPercentageOfRemainingTime, context) {
  const remainingTimeInMillis = context.awsContext.getRemainingTimeInMillis();
  return Math.round(remainingTimeInMillis * timeoutAtPercentageOfRemainingTime);
}
function calculateTimeoutMs(timeoutAtPercentageOfRemainingTime, context) {
  const remainingTimeInMillis = context.awsContext.getRemainingTimeInMillis();
  return Math.round(remainingTimeInMillis * timeoutAtPercentageOfRemainingTime);
}
function calculateTimeoutMs ( timeoutAtPercentageOfRemainingTime , context ) { const remainingTimeInMillis = context . awsContext . getRemainingTimeInMillis ( ) ; return Math . round ( remainingTimeInMillis * timeoutAtPercentageOfRemainingTime ) ; }
Calculates the number of milliseconds to wait before timing out using the given timeoutAtPercentageOfRemainingTime
and the Lambda's remaining time to execute.
@param {number} timeoutAtPercentageOfRemainingTime - the percentage of the remaining time at which to timeout
the given task (expressed as a number between 0.0 and 1.0, e.g. 0.9 would mean timeout at 90% of the remaining time)
@param {StreamConsumerContext} context - the context to use
@returns {number} the number of milliseconds to wait
Calculates the number of milliseconds to wait before timing out using the given timeoutAtPercentageOfRemainingTime and the Lambda s remaining time to execute .