Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ratelimit check #78

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading