Compare commits

...

5 Commits

Author SHA1 Message Date
Qstick
cc841fe3d1 Remove Preview from Page Title 2023-01-02 18:06:34 -06:00
Qstick
264ffdcc26 Fixup Provider Tests 2023-01-02 17:41:41 -06:00
Qstick
5cc044aa8f Rarbg Rate Limit Tweaks, Additional back-off level 2023-01-02 17:16:46 -06:00
Bogdan
de2fd92b6f Fixed: (Avistaz) Workaround for fetching "retry-after" header not present when using "Accept: application/json" 2023-01-01 15:31:26 -06:00
Qstick
eff09c1f72 Treat Master as a valid branch 2022-12-31 19:32:06 -06:00
9 changed files with 17 additions and 30 deletions

View File

@@ -11,7 +11,7 @@
<!-- Windows Phone -->
<meta name="msapplication-navbutton-color" content="#3a3f51" />
<meta name="description" content="Prowlarr (Preview)" />
<meta name="description" content="Prowlarr" />
<link
rel="apple-touch-icon"
@@ -50,7 +50,7 @@
<link rel="stylesheet" type="text/css" href="/Content/Fonts/fonts.css">
<!-- webpack bundles head -->
<title>Prowlarr (Preview)</title>
<title>Prowlarr</title>
<!--
The super basic styling for .root will live here,

View File

@@ -28,15 +28,15 @@ namespace NzbDrone.Core.Test.HealthCheck.Checks
[Test]
public void should_return_warning_when_branch_not_valid()
{
GivenValidBranch("master");
GivenValidBranch("test");
Subject.Check().ShouldBeWarning();
}
[TestCase("Develop")]
[TestCase("develop")]
[TestCase("nightly")]
[TestCase("Nightly")]
[TestCase("develop")]
[TestCase("master")]
public void should_return_no_warning_when_branch_valid(string branch)
{
GivenValidBranch(branch);

View File

@@ -90,7 +90,7 @@ namespace NzbDrone.Core.Test.ThingiProviderTests
var status = Subject.GetBlockedProviders().FirstOrDefault();
status.Should().NotBeNull();
status.DisabledTill.Should().HaveValue();
status.DisabledTill.Value.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(5), 500);
status.DisabledTill.Value.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(1), 500);
}
[Test]
@@ -133,7 +133,7 @@ namespace NzbDrone.Core.Test.ThingiProviderTests
var status = Subject.GetBlockedProviders().FirstOrDefault();
status.Should().NotBeNull();
status.DisabledTill.Should().HaveValue();
status.DisabledTill.Value.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(15), 500);
status.DisabledTill.Value.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(5), 500);
}
[Test]
@@ -160,7 +160,7 @@ namespace NzbDrone.Core.Test.ThingiProviderTests
status.Should().NotBeNull();
origStatus.EscalationLevel.Should().Be(3);
status.DisabledTill.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(5), 500);
status.DisabledTill.Should().BeCloseTo(_epoch + TimeSpan.FromMinutes(1), 500);
}
}
}

View File

@@ -33,7 +33,7 @@ namespace NzbDrone.Core.Configuration
var releaseInfoPath = Path.Combine(bin, "release_info");
PackageUpdateMechanism = UpdateMechanism.BuiltIn;
DefaultBranch = "develop";
DefaultBranch = "master";
if (Path.GetFileName(bin) == "bin" && diskProvider.FileExists(packageInfoPath))
{

View File

@@ -31,6 +31,7 @@ namespace NzbDrone.Core.HealthCheck.Checks
public enum ReleaseBranches
{
Master,
Develop,
Nightly
}

View File

@@ -73,7 +73,8 @@ namespace NzbDrone.Core.Indexers.Definitions.Avistaz
{
var searchUrl = SearchUrl + "?" + searchParameters.GetQueryString();
var request = new IndexerRequest(searchUrl, HttpAccept.Json);
// TODO: Change to HttpAccept.Json after they fix the issue with missing headers
var request = new IndexerRequest(searchUrl, HttpAccept.Html);
request.HttpRequest.Headers.Add("Authorization", $"Bearer {Settings.Token}");
yield return request;

View File

@@ -1,19 +1,14 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Json;
using System.Threading.Tasks;
using System.Web;
using Newtonsoft.Json;
using NLog;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Extensions;
using NzbDrone.Common.Http;
using NzbDrone.Core.Configuration;
using NzbDrone.Core.Exceptions;
using NzbDrone.Core.Http.CloudFlare;
using NzbDrone.Core.Indexers.Exceptions;
using NzbDrone.Core.Messaging.Events;
using NzbDrone.Core.Parser;
using NzbDrone.Core.Validation;
@@ -107,7 +102,6 @@ namespace NzbDrone.Core.Indexers.Rarbg
var response = await FetchIndexerResponse(request);
// try and recover from token errors
// Response of 200 and rate_limt of 1 requires a 5 minute backoff. Handle in Response Parsing & do not page further if rate_limit is populated.
var jsonResponse = new HttpResponse<RarbgResponse>(response.HttpResponse);
if (jsonResponse.Resource.error_code.HasValue)
@@ -126,7 +120,7 @@ namespace NzbDrone.Core.Indexers.Rarbg
}
else if (jsonResponse.Resource.error_code == 5)
{
_logger.Debug("Rarbg temp rate limit hit, retying request");
_logger.Debug("Rarbg temp rate limit hit, retrying request");
response = await FetchIndexerResponse(request);
}
}

View File

@@ -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

View File

@@ -1,10 +1,11 @@
namespace NzbDrone.Core.ThingiProvider.Status
namespace NzbDrone.Core.ThingiProvider.Status
{
public static class EscalationBackOff
{
public static readonly int[] Periods =
{
0,
60,
5 * 60,
15 * 60,
30 * 60,