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 @@ namespace NzbDrone.Core.Jobs
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,
@ -54,12 +57,21 @@ namespace NzbDrone.Core.Jobs
_referenceDataProvider.UpdateDailySeries();
foreach (var series in seriesToUpdate)
{
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 @@ namespace NzbDrone.Core.Providers
}
}
try
{
_database.InsertMany(newList);
_database.UpdateMany(updateList);
}
catch(Exception ex)
{
Logger.WarnException("Failed to update episode info for series: " + series.Title, ex);
}
Logger.Info("Finished episode refresh for series: {0}. Successful: {1} - Failed: {2} ",
tvDbSeriesInfo.SeriesName, successCount, failCount);