|
|
|
@ -23,19 +23,15 @@ namespace NzbDrone.Core.Indexers.Rarbg
|
|
|
|
|
public IList<ReleaseInfo> ParseResponse(IndexerResponse indexerResponse)
|
|
|
|
|
{
|
|
|
|
|
var results = new List<ReleaseInfo>();
|
|
|
|
|
var retryTime = TimeSpan.FromMinutes(1);
|
|
|
|
|
var responseCode = (int)indexerResponse.HttpResponse.StatusCode;
|
|
|
|
|
|
|
|
|
|
switch (responseCode)
|
|
|
|
|
{
|
|
|
|
|
case (int)HttpStatusCode.TooManyRequests:
|
|
|
|
|
retryTime = TimeSpan.FromMinutes(2);
|
|
|
|
|
throw new TooManyRequestsException(indexerResponse.HttpRequest, indexerResponse.HttpResponse, retryTime);
|
|
|
|
|
throw new TooManyRequestsException(indexerResponse.HttpRequest, indexerResponse.HttpResponse, TimeSpan.FromMinutes(2));
|
|
|
|
|
case 520:
|
|
|
|
|
retryTime = TimeSpan.FromMinutes(3);
|
|
|
|
|
throw new TooManyRequestsException(indexerResponse.HttpRequest, indexerResponse.HttpResponse, retryTime);
|
|
|
|
|
throw new TooManyRequestsException(indexerResponse.HttpRequest, indexerResponse.HttpResponse, TimeSpan.FromMinutes(3));
|
|
|
|
|
case (int)HttpStatusCode.OK:
|
|
|
|
|
retryTime = TimeSpan.FromMinutes(5);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
throw new IndexerException(indexerResponse, "Indexer API call returned an unexpected StatusCode [{0}]", responseCode);
|
|
|
|
@ -43,12 +39,6 @@ namespace NzbDrone.Core.Indexers.Rarbg
|
|
|
|
|
|
|
|
|
|
var jsonResponse = new HttpResponse<RarbgResponse>(indexerResponse.HttpResponse);
|
|
|
|
|
|
|
|
|
|
// Handle 200 Rate Limiting
|
|
|
|
|
if (jsonResponse.Resource.rate_limit == 1)
|
|
|
|
|
{
|
|
|
|
|
throw new TooManyRequestsException(indexerResponse.HttpRequest, indexerResponse.HttpResponse, retryTime);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (jsonResponse.Resource.error_code.HasValue)
|
|
|
|
|
{
|
|
|
|
|
if (jsonResponse.Resource.error_code == 20 || jsonResponse.Resource.error_code == 8
|
|
|
|
|