mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Better Debugging
This commit is contained in:
@@ -42,6 +42,7 @@ class API extends CI_Controller {
|
||||
$result = $this->rate_limit->check($endpoint, $identifier);
|
||||
|
||||
if (!$result['allowed']) {
|
||||
log_message("Debug","Rate limit for ".$endpoint." and ID:".($identifier ?? '')." exceeded");
|
||||
$this->rate_limit->send_limit_exceeded_response($result['retry_after']);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -166,7 +166,6 @@ class Rate_limit {
|
||||
* @param int $retry_after Seconds until retry is allowed
|
||||
*/
|
||||
public function send_limit_exceeded_response($retry_after) {
|
||||
log_message("Error","Rate limit exceeded");
|
||||
http_response_code(429);
|
||||
header('Retry-After: ' . $retry_after);
|
||||
echo json_encode([
|
||||
|
||||
Reference in New Issue
Block a user