Skip to content

Commit

Permalink
Fix sdk Storage retry logic (#7006)
Browse files Browse the repository at this point in the history
  • Loading branch information
sliptype authored Dec 21, 2023
1 parent 500f9a7 commit a002560
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/libs/src/sdk/services/Storage/Storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit a002560

Please sign in to comment.