From a002560c155d58805a61e73de22f8b8d61acc9e2 Mon Sep 17 00:00:00 2001 From: Sebastian Klingler Date: Thu, 21 Dec 2023 12:22:27 -0600 Subject: [PATCH] Fix sdk Storage retry logic (#7006) --- packages/libs/src/sdk/services/Storage/Storage.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/libs/src/sdk/services/Storage/Storage.ts b/packages/libs/src/sdk/services/Storage/Storage.ts index 1ba3c09ded9..ac93416615e 100644 --- a/packages/libs/src/sdk/services/Storage/Storage.ts +++ b/packages/libs/src/sdk/services/Storage/Storage.ts @@ -142,12 +142,13 @@ export class Storage implements StorageService { let lastErr for ( let selectedNode = await this.storageNodeSelector.getSelectedNode(); - this.storageNodeSelector.triedSelectingAllNodes(); + !this.storageNodeSelector.triedSelectingAllNodes(); selectedNode = await this.storageNodeSelector.getSelectedNode(true) ) { request.url = `${selectedNode!}/uploads` try { response = await axios(request) + break } catch (e: any) { lastErr = e // keep trying other nodes } @@ -217,7 +218,7 @@ export class Storage implements StorageService { let lastErr for ( let selectedNode = await this.storageNodeSelector.getSelectedNode(); - this.storageNodeSelector.triedSelectingAllNodes(); + !this.storageNodeSelector.triedSelectingAllNodes(); selectedNode = await this.storageNodeSelector.getSelectedNode(true) ) { try {