Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
} else {
// let us retry to send the message after some time.
const msg =
`[${this._context.namespace.connectionId}] Sender "${this.name}", ` +
`cannot send the message right now. Please try later.`;
log.error(msg);
const amqpError: AmqpError = {
condition: ErrorNameConditionMapper.SenderBusyError,
description: msg
};
reject(translate(amqpError));
}
});
const jitterInSeconds = randomNumberFromInterval(1, 4);
const config: RetryConfig = {
operation: sendEventPromise,
connectionId: this._context.namespace.connectionId!,
operationType: RetryOperationType.sendMessage,
times: Constants.defaultRetryAttempts,
delayInSeconds: Constants.defaultDelayBetweenOperationRetriesInSeconds + jitterInSeconds
};
return retry(config);
}}
} else {
// let us retry to send the message after some time.
const msg =
`[${this._context.namespace.connectionId}] Sender "${this.name}", ` +
`cannot send the message right now. Please try later.`;
log.error(msg);
const amqpError: AmqpError = {
condition: ErrorNameConditionMapper.SenderBusyError,
description: msg
};
reject(translate(amqpError));
}
});
const jitterInSeconds = randomNumberFromInterval(1, 4);
const config: RetryConfig = {
operation: sendEventPromise,
connectionId: this._context.namespace.connectionId!,
operationType: RetryOperationType.sendMessage,
times: Constants.defaultRetryAttempts,
delayInSeconds: Constants.defaultDelayBetweenOperationRetriesInSeconds + jitterInSeconds
};
return retry(config);
}