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

Handle rate limit of CFTools #53

Open
2 tasks
FlorianSW opened this issue Jan 8, 2022 · 0 comments
Open
2 tasks

Handle rate limit of CFTools #53

FlorianSW opened this issue Jan 8, 2022 · 0 comments
Labels
enhancement Improve an existing feature

Comments

@FlorianSW
Copy link
Owner

When checking for priority queue, the tool needs to fetch information for the steam ID, however, this endpoint is rate limited by CFTools. When the tool tries to fetch priority queue status for multiple servers, it can easily end in the following logs (errors):

{"level":"error","message":"Could not request Priority queue information for server API ID: [object Object]. Error: Error: RequestLimitExceeded: https://data.cftools.cloud/v1/users/lookup?identifier=7656xxxx"}

This should either be handled in the sdk or in this tool. Two things to do, I think:

  • reduce number of requests to the endpoint by caching the steam ID -> cftools ID response
  • Handle the rate limit somehow (retry or so)
@FlorianSW FlorianSW added the enhancement Improve an existing feature label Jan 8, 2022
FlorianSW added a commit to FlorianSW/cftools-sdk that referenced this issue Jan 15, 2022
Resolving the passed in player ID is a crucial command used by many
other commands as well. Most users do not pass in a CFToolsId directly,
resulting in numerous times that the passed ID needs to be resolved
before the requested action can be done.

However, the resolve endpoint is under heavy rate limit (20 requests per
minute), resolving the same and the same ID again every time a new
action with an already resolved ID is a waste of resources. After all,
the resolved IDs are static anyway, there is no known way of when the
result of requesting the same ID (Steam ID, BE GUID or BI UID) might
be diffrent.

This commit will bring resolving the IDs under the cache configuration
umbrella. The default caching time for this function, as they are
static, is very high, so that one ID usually does not need to be
resolved twice. It depends on the caching storage, if it can or will
hold the cached results in the cache, though. Also, enabling the cache
is crucial for this to work as well, which is opt-in by the user of this
sdk.

Discovered in FlorianSW/server-donation-tool#53
FlorianSW added a commit that referenced this issue Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improve an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant