mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2025-04-24 22:07:32 -04:00
Fixed: Improve Rarbg Rate Limit Messaging
This commit is contained in:
parent
d8fb71d501
commit
9b10cea556
2 changed files with 5 additions and 3 deletions
|
@ -45,15 +45,17 @@ namespace NzbDrone.Core.Indexers.Definitions.Rarbg
|
|||
return new RarbgParser(Capabilities, _logger);
|
||||
}
|
||||
|
||||
public static void CheckResponseByStatusCode(IndexerResponse response)
|
||||
public static void CheckResponseByStatusCode(IndexerResponse response, Logger logger)
|
||||
{
|
||||
var responseCode = (int)response.HttpResponse.StatusCode;
|
||||
|
||||
switch (responseCode)
|
||||
{
|
||||
case (int)HttpStatusCode.TooManyRequests:
|
||||
logger.Warn("Indexer API limit reached.");
|
||||
throw new TooManyRequestsException(response.HttpRequest, response.HttpResponse, TimeSpan.FromMinutes(2));
|
||||
case 520:
|
||||
logger.Warn("Indexer API error, likely rate limited by origin server.");
|
||||
throw new TooManyRequestsException(response.HttpRequest, response.HttpResponse, TimeSpan.FromMinutes(3));
|
||||
case (int)HttpStatusCode.OK:
|
||||
break;
|
||||
|
@ -116,7 +118,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Rarbg
|
|||
{
|
||||
var response = await base.FetchIndexerResponse(request);
|
||||
|
||||
CheckResponseByStatusCode(response);
|
||||
CheckResponseByStatusCode(response, _logger);
|
||||
|
||||
// try and recover from token errors
|
||||
var jsonResponse = new HttpResponse<RarbgResponse>(response.HttpResponse);
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace NzbDrone.Core.Indexers.Definitions.Rarbg
|
|||
{
|
||||
var results = new List<ReleaseInfo>();
|
||||
|
||||
Rarbg.CheckResponseByStatusCode(indexerResponse);
|
||||
Rarbg.CheckResponseByStatusCode(indexerResponse, _logger);
|
||||
|
||||
var jsonResponse = new HttpResponse<RarbgResponse>(indexerResponse.HttpResponse);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue