From cb90e843d75521d98752d48ee7c80e5b524b82a5 Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Wed, 18 Oct 2023 16:03:00 +1300 Subject: [PATCH 1/2] Fix ratelimit response check --- packages/node/CHANGELOG.md | 2 ++ packages/node/src/algorand/api.connection.ts | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/node/CHANGELOG.md b/packages/node/CHANGELOG.md index a8c4998c..b9fcd379 100644 --- a/packages/node/CHANGELOG.md +++ b/packages/node/CHANGELOG.md @@ -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 diff --git a/packages/node/src/algorand/api.connection.ts b/packages/node/src/algorand/api.connection.ts index 932da986..eeee8442 100644 --- a/packages/node/src/algorand/api.connection.ts +++ b/packages/node/src/algorand/api.connection.ts @@ -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); From 2290754c25aa18b257e9d99a52f7e2c7b7125df1 Mon Sep 17 00:00:00 2001 From: Scott Twiname Date: Wed, 18 Oct 2023 16:05:51 +1300 Subject: [PATCH 2/2] Add changelog release scripts --- packages/common-algorand/package.json | 3 ++- packages/node/package.json | 3 ++- packages/types/package.json | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/common-algorand/package.json b/packages/common-algorand/package.json index 08f482e7..18128b9b 100644 --- a/packages/common-algorand/package.json +++ b/packages/common-algorand/package.json @@ -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", diff --git a/packages/node/package.json b/packages/node/package.json index 8b4332a6..c545dd68 100644 --- a/packages/node/package.json +++ b/packages/node/package.json @@ -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", diff --git a/packages/types/package.json b/packages/types/package.json index 099fb6f3..79718f83 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -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",