Closed vlavrynovych closed 5 years ago
Please assign to me. I'll do the PR
@vlavrynovych this issue is also addressed using a different approach in my promise-based fork that I have open PRs to merge. What I did was to follow the design that Strava uses in their own Go-based REST client. Instead of including an extra payload
argument to the callback`, the module stores the rate-limiting status globally. A couple convenient methods are added to check the status:
https://github.com/RideAmigosCorp/node-strava-v3/tree/ra-fixes#global-status
// returns true if the most recent request exceeded the rate limit
strava.rateLimiting.exceeded()
// returns the current decimal fraction (from 0 to 1) of rate used. The greater of the short and long term limits.
strava.rateLimiting.fractionReached();
@markstos original problem isn't related to the rate limiting. I'm getting exception in my project once I reach limit. As for me there is no difference how to get rate limiting info. I just want to stabilize the execution process.
The promise-based fork is getting merged. Since I think the issue is resolved there, I'm closing this.
/Users/vlavrynovych/Workspace/vlavrynovych/strive/node_modules/strava-v3/lib/util.js in Request._callback at line 220:52