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

When chaining methods to purge by surrogate key, get_service API call is executed every time #50

Closed
kigster opened this issue May 14, 2015 · 1 comment

Comments

@kigster
Copy link

kigster commented May 14, 2015

We needed to purge objects by a surrogate key, and had the code shown in the image below (red). We were instantiating Fastly.new object, then calling get_service(), and then chaining purge_by_key(key). This usage ends up calling an API to get service every time for each purge, and we ended up exceeding rate limits for the API.

The solution is shown in green, and should probably be documented somewhere. Perhaps another class Purge should take care of executing these calls efficiently, given that all keys and api_keys are known ahead of time.

Diff that got rid of an extra get_service API call to Fastly per purge

@drbrain
Copy link
Contributor

drbrain commented May 15, 2015

@kigster how does #51 look to you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants