From 661fccba2042061a3d9e27da72a4abb110070db1 Mon Sep 17 00:00:00 2001 From: Mathieu De Zutter Date: Mon, 13 Nov 2023 13:31:18 +0100 Subject: [PATCH 1/2] Fix detection of secondary rate limit Actual error message is "You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later. If you reach out to GitHub Support for help, please include the request ID [...]" --- lib/Github/HttpClient/Plugin/GithubExceptionThrower.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Github/HttpClient/Plugin/GithubExceptionThrower.php b/lib/Github/HttpClient/Plugin/GithubExceptionThrower.php index 773c88501f2..9479aaaf2be 100644 --- a/lib/Github/HttpClient/Plugin/GithubExceptionThrower.php +++ b/lib/Github/HttpClient/Plugin/GithubExceptionThrower.php @@ -128,7 +128,7 @@ public function handleRequest(RequestInterface $request, callable $next, callabl } $reset = (int) ResponseMediator::getHeader($response, 'X-RateLimit-Reset'); - if ((403 === $response->getStatusCode()) && 0 < $reset && isset($content['message']) && (0 === strpos($content['message'], 'You have exceeded a secondary rate limit.'))) { + if ((403 === $response->getStatusCode()) && 0 < $reset && isset($content['message']) && (0 === strpos($content['message'], 'You have exceeded a secondary rate limit'))) { $limit = (int) ResponseMediator::getHeader($response, 'X-RateLimit-Limit'); throw new ApiLimitExceedException($limit, $reset); From 7d8aeb65be07542af91763f5a0dcede351390929 Mon Sep 17 00:00:00 2001 From: Mathieu De Zutter Date: Tue, 14 Nov 2023 19:48:56 +0100 Subject: [PATCH 2/2] Update secondary rate limit test with new message --- .../Tests/HttpClient/Plugin/GithubExceptionThrowerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/Github/Tests/HttpClient/Plugin/GithubExceptionThrowerTest.php b/test/Github/Tests/HttpClient/Plugin/GithubExceptionThrowerTest.php index f8090ef622c..b2541ec0942 100644 --- a/test/Github/Tests/HttpClient/Plugin/GithubExceptionThrowerTest.php +++ b/test/Github/Tests/HttpClient/Plugin/GithubExceptionThrowerTest.php @@ -103,7 +103,7 @@ public static function responseProvider() ], json_encode( [ - 'message' => 'You have exceeded a secondary rate limit. Please wait a few minutes before you try again.', + 'message' => 'You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later. If you reach out to GitHub Support for help, please include the request ID #xxxxxxx.', ] ) ),