Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function updateMessageVisibilityTimeout(
queueService: QueueService,
queueName: string,
queueMessageBindings: Context["bindings"]
): Promise {
const queueMessageValidation = QueueMessage.decode(queueMessageBindings);
if (queueMessageValidation.isLeft()) {
winston.error(
`Unable to decode queue message from bindings: ${ReadableReporter.report(
queueMessageValidation
)}`
);
return Promise.reject(new Error("INVALID_QUEUE_MESSAGE_IN_BINDINGS"));
}
const queueMessage = queueMessageValidation.value;
return new Promise(resolve => {
winston.debug(
`updateMessageVisibilityTimeout|Retry to handle message ${queueName}:${queueMessageToString(
queueMessage
)}`
);
// dequeueCount starts with one (not zero)
const numberOfRetries = queueMessage.dequeueCount;