w3f / staking-rewards-collector

Apache License 2.0
78 stars 32 forks source link

add API rate limit #30

Closed bjweaver closed 2 years ago

bjweaver commented 3 years ago

Subscan implemented an API rate limit which causes rewards calculation to fail.

{ message: 'API rate limit exceeded' } TypeError: Cannot read property 'count' of undefined

jonasW3F commented 3 years ago

@bjweaver Could you please quickly make the requested changes, then I can merge your PR. Thanks!

Edit: I just tried the master branch with some addresses, even added two addresses with 5000 staking rewards each and did not run into any API issue. It could be that the issue you experienced was caused by the malfunction of Subscan's API and is now fixed. Could you check again? Maybe a delay is unnecessary.

I included this address "Cn4ySvWgpAqPVj1pwETTPd7eqpg85Cf3KGojG9CJfoK1gp8" and parsed 15k rewards without an issue.

bjweaver commented 3 years ago

I'm still seeing the issue.

yarn run v1.22.10 $ node src/index.js TypeError: Cannot read property 'count' of undefined