Skip to content

Commit

Permalink
Fix ratelimit check (#78)
Browse files Browse the repository at this point in the history
* Fix ratelimit response check

* Add changelog release scripts
  • Loading branch information
stwiname authored Oct 18, 2023
1 parent 0fa9d08 commit 137073d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/common-algorand/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"scripts": {
"build": "rm -rf dist && tsc -b",
"test": "echo \"Error: no test specified\" && exit 1",
"format": "prettier --write \"src/**/*.ts\""
"format": "prettier --write \"src/**/*.ts\"",
"changelog:release": "echo \"Updating changelog $npm_package_version\" && npx chan release $npm_package_version --git-url \"https://github.com/subquery/subql-algorand\" --release-prefix=\"common-algorand/\""
},
"homepage": "https://github.com/subquery/subql",
"repository": "github:subquery/subql-algorand",
Expand Down
2 changes: 2 additions & 0 deletions packages/node/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Fixed
- 429 rate limit error handling

## [3.0.1] - 2023-10-12
### Changed
Expand Down
3 changes: 2 additions & 1 deletion packages/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nodemon",
"start:prod": "node dist/main"
"start:prod": "node dist/main",
"changelog:release": "echo \"Updating changelog $npm_package_version\" && npx chan release $npm_package_version --git-url \"https://github.com/subquery/subql-algorand\" --release-prefix=\"node-algorand/\""
},
"homepage": "https://github.com/subquery/subql",
"repository": "github:subquery/subql-algorand",
Expand Down
5 changes: 4 additions & 1 deletion packages/node/src/algorand/api.connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ export class AlgorandApiConnection
formatted_error = AlgorandApiConnection.handleTimeoutError(e);
} else if (e.message.startsWith(`disconnected from `)) {
formatted_error = AlgorandApiConnection.handleDisconnectionError(e);
} else if (e.message.startsWith(`Rate Limited at endpoint`)) {
} else if (
e.message.startsWith(`Rate Limited at endpoint`) ||
(e as any).statusCode === 429
) {
formatted_error = AlgorandApiConnection.handleRateLimitError(e);
} else if (e.message.includes(`Exceeded max limit of`)) {
formatted_error = AlgorandApiConnection.handleLargeResponseError(e);
Expand Down
3 changes: 2 additions & 1 deletion packages/types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"repository": "github:subquery/subql-algorand",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "rm -rf dist && tsc -b"
"build": "rm -rf dist && tsc -b",
"changelog:release": "echo \"Updating changelog $npm_package_version\" && npx chan release $npm_package_version --git-url \"https://github.com/subquery/subql-algorand\" --release-prefix=\"types-algorand/\""
},
"author": "Ian He",
"main": "dist/index.js",
Expand Down

0 comments on commit 137073d

Please sign in to comment.