protected function Github_HttpClient::updateHistory in Bibliography Module 7.2
Records the requests times When 30 request have been sent in less than a minute, sleeps for two second to prevent reaching GitHub API limitation.
@access protected
Return value
void
1 call to Github_HttpClient::updateHistory()
- Github_HttpClient::request in modules/
CiteProc/ Github/ HttpClient.php - Send a request to the server, receive a response, decode the response and returns an associative array
File
- modules/
CiteProc/ Github/ HttpClient.php, line 152
Class
- Github_HttpClient
- Performs requests on GitHub API. API documentation should be self-explanatory.
Code
protected function updateHistory() {
self::$history[] = time();
if (30 === count(self::$history)) {
if (reset(self::$history) >= time() - 35) {
sleep(2);
}
array_shift(self::$history);
}
}