Added asp.net tick timer

Added health monitoring
Updated database logging
This commit is contained in:
kay.one 2011-04-21 19:23:31 -07:00
commit e9c63b81e6
27 changed files with 679 additions and 378 deletions

View file

@ -22,21 +22,20 @@ namespace NzbDrone.Core.Providers
{
}
public virtual List<History> AllItems()
public virtual IQueryable<History> AllItems()
{
return _sonicRepo.All<History>().ToList();
return _sonicRepo.All<History>();
}
public virtual void Purge()
{
var all = _sonicRepo.All<History>();
_sonicRepo.DeleteMany(all);
_sonicRepo.DeleteMany(AllItems());
Logger.Info("History has been Purged");
}
public virtual void Trim()
{
var old = _sonicRepo.All<History>().Where(h => h.Date < DateTime.Now.AddDays(-30));
var old = AllItems().Where(h => h.Date < DateTime.Now.AddDays(-30));
_sonicRepo.DeleteMany(old);
Logger.Info("History has been trimmed, items older than 30 days have been removed");
}
@ -44,16 +43,16 @@ namespace NzbDrone.Core.Providers
public virtual void Insert(History item)
{
_sonicRepo.Add(item);
//Logger.Info("Item added to history: {0} - {1}x{2:00}", item.Episode.Series.Title, item.Episode.SeasonNumber, item.Episode.EpisodeNumber);
Logger.Debug("Item added to history: {0} - {1}x{2:00}", item.Episode.Series.Title, item.Episode.SeasonNumber, item.Episode.EpisodeNumber);
}
public virtual bool Exists(int episodeId, QualityTypes quality, bool proper)
{
//Looks for the existance of this episode in History
//Looks for the existence of this episode in History
if (_sonicRepo.Exists<History>(h => h.EpisodeId == episodeId && h.Quality == quality && h.IsProper == proper))
return true;
Logger.Debug("Episode not in History: {0}", episodeId);
Logger.Debug("Episode not in History. ID:{0} Q:{1} Proper:{2}", episodeId , quality, proper);
return false;
}
}