Skip to content

Commit

Permalink
fix sdk retry mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
juraj.bacovcin committed Dec 20, 2024
1 parent 78fbfff commit 74f5c25
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [4.2.45] - 2024.12.20

### Fixed

- Fixed Tatum Connector retry logic causing generic error

## [4.2.44] - 2024.12.5

### Added
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tatumio/tatum",
"version": "4.2.44",
"version": "4.2.45",
"description": "Tatum JS SDK",
"author": "Tatum",
"repository": "https://github.com/tatumio/tatum-js",
Expand Down
5 changes: 2 additions & 3 deletions src/connector/tatum.connector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,9 @@ export class TatumConnector {
return await res.blob()
}
const response = await res.json()
if (response?.error) {
return await this.retry(url, request, res, retry)
if (!response?.error) {
return response
}
return response
}

// Retry only in case of 5xx error
Expand Down
2 changes: 1 addition & 1 deletion src/service/rpc/generic/LoadBalancer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ export class LoadBalancer implements AbstractRpcInterface {
)
if (index === -1) {
this.logger.error(
`All RPC nodes are unavailable. Looks like your request is malformed or all nodes are down. Turn on verbose mode to see more details and check status pages.`,
`Looks like your request is malformed or all RPC nodes are down. Turn on verbose mode to see more details and check status pages.`,
)
throw e
}
Expand Down

0 comments on commit 74f5c25

Please sign in to comment.