Skip to content

Instantly share code, notes, and snippets.

@adragomir
Created August 12, 2020 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adragomir/fca4fbec5ad22cdc00cabf9798bfd624 to your computer and use it in GitHub Desktop.
Save adragomir/fca4fbec5ad22cdc00cabf9798bfd624 to your computer and use it in GitHub Desktop.
// is_throttled should throttle a request per api to 10 requests per second
function is_throttled(...) {
}
function api($endpoint) {
if (is_throttled(...)) {
return "429 too soon";
}
return "Api content for " . $endpoint;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment