1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 04:22:30 +01:00

Fixed: Don't apply indexer backoff on DNS and connection issues.

Fixes #751
This commit is contained in:
Taloth Saldono 2016-01-17 19:22:43 +01:00
parent 45d4371328
commit 0d19f645e8
2 changed files with 27 additions and 3 deletions

View File

@ -202,7 +202,16 @@ protected virtual IList<ReleaseInfo> FetchReleases(IndexerPageableRequestChain p
}
catch (WebException webException)
{
_indexerStatusService.RecordFailure(Definition.Id);
if (webException.Status == WebExceptionStatus.NameResolutionFailure ||
webException.Status == WebExceptionStatus.ConnectFailure)
{
_indexerStatusService.RecordConnectionFailure(Definition.Id);
}
else
{
_indexerStatusService.RecordFailure(Definition.Id);
}
if (webException.Message.Contains("502") || webException.Message.Contains("503") ||
webException.Message.Contains("timed out"))
{

View File

@ -15,6 +15,7 @@ public interface IIndexerStatusService
ReleaseInfo GetLastRssSyncReleaseInfo(int indexerId);
void RecordSuccess(int indexerId);
void RecordFailure(int indexerId, TimeSpan minimumBackOff = default(TimeSpan));
void RecordConnectionFailure(int indexerId);
void UpdateRssSyncStatus(int indexerId, ReleaseInfo releaseInfo);
}
@ -85,7 +86,7 @@ public void RecordSuccess(int indexerId)
}
}
public void RecordFailure(int indexerId, TimeSpan minimumBackOff = default(TimeSpan))
protected void RecordFailure(int indexerId, TimeSpan minimumBackOff, bool escalate)
{
lock (_syncRoot)
{
@ -99,7 +100,10 @@ public void RecordSuccess(int indexerId)
}
status.MostRecentFailure = now;
status.EscalationLevel = Math.Min(MaximumEscalationLevel, status.EscalationLevel + 1);
if (escalate)
{
status.EscalationLevel = Math.Min(MaximumEscalationLevel, status.EscalationLevel + 1);
}
if (minimumBackOff != TimeSpan.Zero)
{
@ -115,6 +119,17 @@ public void RecordSuccess(int indexerId)
}
}
public void RecordFailure(int indexerId, TimeSpan minimumBackOff = default(TimeSpan))
{
RecordFailure(indexerId, minimumBackOff, true);
}
public void RecordConnectionFailure(int indexerId)
{
RecordFailure(indexerId, default(TimeSpan), false);
}
public void UpdateRssSyncStatus(int indexerId, ReleaseInfo releaseInfo)
{
lock (_syncRoot)