From 7277fe203dc17869c025ee6741b65715878e465f Mon Sep 17 00:00:00 2001 From: Gabor Galazzo Date: Sun, 17 Mar 2024 00:08:37 +0100 Subject: [PATCH] Simplify recursive function in vault-backend plugin The update removes a lock inside a recursive function in the vault-backend plugin's vaultApi.ts file. This change helps to prevent potential deadlocks, improving the performance and overall reliability of the code by ensuring it does not get stuck in a locked state. Signed-off-by: Gabor Galazzo --- .changeset/angry-stingrays-cover.md | 5 +++++ plugins/vault-backend/src/service/vaultApi.ts | 8 +++----- 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 .changeset/angry-stingrays-cover.md diff --git a/.changeset/angry-stingrays-cover.md b/.changeset/angry-stingrays-cover.md new file mode 100644 index 0000000000..49fe04bb7e --- /dev/null +++ b/.changeset/angry-stingrays-cover.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-vault-backend': patch +--- + +Removed lock inside recursion to avoid deadlocks diff --git a/plugins/vault-backend/src/service/vaultApi.ts b/plugins/vault-backend/src/service/vaultApi.ts index 789cdeeda5..b337a877b9 100644 --- a/plugins/vault-backend/src/service/vaultApi.ts +++ b/plugins/vault-backend/src/service/vaultApi.ts @@ -147,11 +147,9 @@ export class VaultClient implements VaultApi { result.data.keys.map(async secret => { if (secret.endsWith('/')) { secrets.push( - ...(await this.limit(() => - this.listSecrets(`${secretPath}/${secret.slice(0, -1)}`, { - secretEngine: mount, - }), - )), + ...(await this.listSecrets(`${secretPath}/${secret.slice(0, -1)}`, { + secretEngine: mount, + })), ); } else { const vaultUrl =