1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-09 12:32:31 +01:00

Moved try/catch for failed refresh episode info to job.

This commit is contained in:
Mark McDowall 2012-01-04 11:24:17 -08:00
parent e958a019ed
commit e4985cbd66
2 changed files with 19 additions and 14 deletions

View File

@ -1,5 +1,7 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using NLog;
using Ninject;
using NzbDrone.Core.Helpers;
using NzbDrone.Core.Model.Notification;
@ -13,6 +15,7 @@ public class UpdateInfoJob : IJob
private readonly SeriesProvider _seriesProvider;
private readonly EpisodeProvider _episodeProvider;
private readonly ReferenceDataProvider _referenceDataProvider;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
[Inject]
public UpdateInfoJob(SeriesProvider seriesProvider, EpisodeProvider episodeProvider,
@ -55,10 +58,19 @@ public virtual void Start(ProgressNotification notification, int targetId, int s
foreach (var series in seriesToUpdate)
{
notification.CurrentMessage = "Updating " + series.Title;
_seriesProvider.UpdateSeriesInfo(series.SeriesId);
_episodeProvider.RefreshEpisodeInfo(series);
notification.CurrentMessage = "Update completed for " + series.Title;
try
{
notification.CurrentMessage = "Updating " + series.Title;
_seriesProvider.UpdateSeriesInfo(series.SeriesId);
_episodeProvider.RefreshEpisodeInfo(series);
notification.CurrentMessage = "Update completed for " + series.Title;
}
catch(Exception ex)
{
Logger.ErrorException("Failed to update episode info for series: " + series.Title, ex);
}
}
}
}

View File

@ -321,15 +321,8 @@ public virtual void RefreshEpisodeInfo(Series series)
}
}
try
{
_database.InsertMany(newList);
_database.UpdateMany(updateList);
}
catch(Exception ex)
{
Logger.WarnException("Failed to update episode info for series: " + series.Title, ex);
}
_database.InsertMany(newList);
_database.UpdateMany(updateList);
Logger.Info("Finished episode refresh for series: {0}. Successful: {1} - Failed: {2} ",
tvDbSeriesInfo.SeriesName, successCount, failCount);