Skip to content

Commit 3459af2

Browse files
committed
Make AMQP depth test cleanup best-effort
Ensure a teardown failure while deleting one queue does not skip the remaining queue cleanup or channel and connection close calls. #748 (comment) Assisted-by: Codex:gpt-5.5
1 parent b14f2ef commit 3459af2

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

packages/amqp/src/mq.test.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,15 @@ test(
7272
delayed: 1,
7373
});
7474
} finally {
75-
const channel = await conn.createChannel();
76-
await channel.deleteQueue(queue);
77-
await channel.deleteQueue(`${delayedQueuePrefix}60000`).catch(() => {});
78-
await channel.close();
79-
await conn.close();
75+
const channel = await conn.createChannel().catch(() => undefined);
76+
try {
77+
await channel?.deleteQueue(queue).catch(() => {});
78+
await channel?.deleteQueue(`${delayedQueuePrefix}60000`).catch(() => {
79+
});
80+
} finally {
81+
await channel?.close().catch(() => {});
82+
await conn.close().catch(() => {});
83+
}
8084
}
8185
},
8286
);

0 commit comments

Comments
 (0)