Skip to content

Commit

Permalink
[MRA-845] initialize setTimeOutPromise just once
Browse files Browse the repository at this point in the history
  • Loading branch information
ammsalme committed Jan 17, 2025
1 parent c6279ee commit 331e6bb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/amqp.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export default async function (AMQP_URL, runHealthCheck = false) {
const debug = createDebugLogger('@natlibfi/melinda-rest-api-commons:amqp');
const debugHC = debug.extend('HC');
const debugData = debug.extend('data');
const setTimeoutPromise = promisify(setTimeout);

debug(`Creating an AMQP operator to ${AMQP_URL}`);
const connection = await amqplib.connect(AMQP_URL);
Expand All @@ -39,7 +40,6 @@ export default async function (AMQP_URL, runHealthCheck = false) {
}

async function healthCheck(wait = false) {
const setTimeoutPromise = promisify(setTimeout);
if (wait) {
await setTimeoutPromise(wait);
return healthCheck(false);
Expand Down

0 comments on commit 331e6bb

Please sign in to comment.