Skip to content

Instantly share code, notes, and snippets.

@adragomir
Created August 12, 2020 13:57
Show Gist options
  • Save adragomir/948cf8ffe842e0e084ede3e0383e3715 to your computer and use it in GitHub Desktop.
Save adragomir/948cf8ffe842e0e084ede3e0383e3715 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