kucoin-node-sdk icon indicating copy to clipboard operation
kucoin-node-sdk copied to clipboard

Catching "Too many request" error

Open fedeiglesias opened this issue 2 years ago • 1 comments

When I make an overload test, calling getOrderById too many times in shot amount of time, i can't catch request limit error.

My intention is to catch this error, wait 10 seconds or more and retry the request. But using a Try-Catch block to make this happen I get always next error:

FetchError: invalid json response body at https://api.kucoin.com/api/v1/orders/62d99d248d3eb700016140dc? reason: Unexpected token < in JSON at position 0

I was digging into the createHttp lib, I think this can be the problem https://github.com/Kucoin/kucoin-node-sdk/blob/8a79c5d5fff46e0aca816e45df8b1dda12f058b2/src/lib/createHttp.js#L92

Can anyone give me some help on this?

fedeiglesias avatar Sep 28 '22 18:09 fedeiglesias