mirror of
https://github.com/Radarr/Radarr
synced 2025-12-06 16:32:36 +01:00
Avoid varying logging message template between calls
This commit is contained in:
parent
c58a9b3f2c
commit
c2c3dfe917
2 changed files with 8 additions and 15 deletions
|
|
@ -12,8 +12,6 @@ namespace NzbDrone.Core.Indexers
|
||||||
{
|
{
|
||||||
public class RssSyncService : IExecute<RssSyncCommand>
|
public class RssSyncService : IExecute<RssSyncCommand>
|
||||||
{
|
{
|
||||||
private readonly IIndexerStatusService _indexerStatusService;
|
|
||||||
private readonly IIndexerFactory _indexerFactory;
|
|
||||||
private readonly IFetchAndParseRss _rssFetcherAndParser;
|
private readonly IFetchAndParseRss _rssFetcherAndParser;
|
||||||
private readonly IMakeDownloadDecision _downloadDecisionMaker;
|
private readonly IMakeDownloadDecision _downloadDecisionMaker;
|
||||||
private readonly IProcessDownloadDecisions _processDownloadDecisions;
|
private readonly IProcessDownloadDecisions _processDownloadDecisions;
|
||||||
|
|
@ -21,17 +19,13 @@ public class RssSyncService : IExecute<RssSyncCommand>
|
||||||
private readonly IEventAggregator _eventAggregator;
|
private readonly IEventAggregator _eventAggregator;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public RssSyncService(IIndexerStatusService indexerStatusService,
|
public RssSyncService(IFetchAndParseRss rssFetcherAndParser,
|
||||||
IIndexerFactory indexerFactory,
|
|
||||||
IFetchAndParseRss rssFetcherAndParser,
|
|
||||||
IMakeDownloadDecision downloadDecisionMaker,
|
IMakeDownloadDecision downloadDecisionMaker,
|
||||||
IProcessDownloadDecisions processDownloadDecisions,
|
IProcessDownloadDecisions processDownloadDecisions,
|
||||||
IPendingReleaseService pendingReleaseService,
|
IPendingReleaseService pendingReleaseService,
|
||||||
IEventAggregator eventAggregator,
|
IEventAggregator eventAggregator,
|
||||||
Logger logger)
|
Logger logger)
|
||||||
{
|
{
|
||||||
_indexerStatusService = indexerStatusService;
|
|
||||||
_indexerFactory = indexerFactory;
|
|
||||||
_rssFetcherAndParser = rssFetcherAndParser;
|
_rssFetcherAndParser = rssFetcherAndParser;
|
||||||
_downloadDecisionMaker = downloadDecisionMaker;
|
_downloadDecisionMaker = downloadDecisionMaker;
|
||||||
_processDownloadDecisions = processDownloadDecisions;
|
_processDownloadDecisions = processDownloadDecisions;
|
||||||
|
|
@ -51,14 +45,14 @@ private async Task<ProcessedDecisions> Sync()
|
||||||
var decisions = _downloadDecisionMaker.GetRssDecision(reports);
|
var decisions = _downloadDecisionMaker.GetRssDecision(reports);
|
||||||
var processed = await _processDownloadDecisions.ProcessDecisions(decisions);
|
var processed = await _processDownloadDecisions.ProcessDecisions(decisions);
|
||||||
|
|
||||||
var message = string.Format("RSS Sync Completed. Reports found: {0}, Reports grabbed: {1}", reports.Count, processed.Grabbed.Count);
|
|
||||||
|
|
||||||
if (processed.Pending.Any())
|
if (processed.Pending.Any())
|
||||||
{
|
{
|
||||||
message += ", Reports pending: " + processed.Pending.Count;
|
_logger.ProgressInfo("RSS Sync Completed. Reports found: {0}, Reports grabbed: {1}, Reports pending: {2}", reports.Count, processed.Grabbed.Count, processed.Pending.Count);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_logger.ProgressInfo("RSS Sync Completed. Reports found: {0}, Reports grabbed: {1}", reports.Count, processed.Grabbed.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.ProgressInfo(message);
|
|
||||||
|
|
||||||
return processed;
|
return processed;
|
||||||
}
|
}
|
||||||
|
|
@ -66,7 +60,6 @@ private async Task<ProcessedDecisions> Sync()
|
||||||
public void Execute(RssSyncCommand message)
|
public void Execute(RssSyncCommand message)
|
||||||
{
|
{
|
||||||
var processed = Sync().GetAwaiter().GetResult();
|
var processed = Sync().GetAwaiter().GetResult();
|
||||||
var grabbedOrPending = processed.Grabbed.Concat(processed.Pending).ToList();
|
|
||||||
|
|
||||||
_eventAggregator.PublishEvent(new RssSyncCompleteEvent(processed));
|
_eventAggregator.PublishEvent(new RssSyncCompleteEvent(processed));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ public ValidationFailure Test(AppriseSettings settings)
|
||||||
{
|
{
|
||||||
if (httpException.Response.StatusCode == HttpStatusCode.Unauthorized)
|
if (httpException.Response.StatusCode == HttpStatusCode.Unauthorized)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, $"HTTP Auth credentials are invalid: {0}", ex.Message);
|
_logger.Error(ex, "HTTP Auth credentials are invalid: {0}", ex.Message);
|
||||||
return new ValidationFailure("AuthUsername", _localizationService.GetLocalizedString("NotificationsValidationInvalidHttpCredentials", new Dictionary<string, object> { { "exceptionMessage", ex.Message } }));
|
return new ValidationFailure("AuthUsername", _localizationService.GetLocalizedString("NotificationsValidationInvalidHttpCredentials", new Dictionary<string, object> { { "exceptionMessage", ex.Message } }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,7 +103,7 @@ public ValidationFailure Test(AppriseSettings settings)
|
||||||
{
|
{
|
||||||
var error = Json.Deserialize<AppriseError>(httpException.Response.Content);
|
var error = Json.Deserialize<AppriseError>(httpException.Response.Content);
|
||||||
|
|
||||||
_logger.Error(ex, $"Unable to send test message. Response from API: {0}", error.Error);
|
_logger.Error(ex, "Unable to send test message. Response from API: {0}", error.Error);
|
||||||
return new ValidationFailure(string.Empty, _localizationService.GetLocalizedString("NotificationsValidationUnableToSendTestMessageApiResponse", new Dictionary<string, object> { { "error", error.Error } }));
|
return new ValidationFailure(string.Empty, _localizationService.GetLocalizedString("NotificationsValidationUnableToSendTestMessageApiResponse", new Dictionary<string, object> { { "error", error.Error } }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue