mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 13:33:34 -07:00
Added asp.net tick timer
Added health monitoring Updated database logging
This commit is contained in:
parent
7d7032dd56
commit
e9c63b81e6
27 changed files with 679 additions and 378 deletions
33
NzbDrone.Core/WebTimer.cs
Normal file
33
NzbDrone.Core/WebTimer.cs
Normal file
|
@ -0,0 +1,33 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Web;
|
||||
using System.Web.Caching;
|
||||
using NLog;
|
||||
|
||||
namespace NzbDrone.Core
|
||||
{
|
||||
class WebTimer
|
||||
{
|
||||
|
||||
private static CacheItemRemovedCallback _onCacheRemove;
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
|
||||
public void StartTimer(int secondInterval)
|
||||
{
|
||||
_onCacheRemove = new CacheItemRemovedCallback(DoWork);
|
||||
|
||||
HttpRuntime.Cache.Insert(GetType().ToString(), secondInterval, null,
|
||||
DateTime.Now.AddSeconds(secondInterval), Cache.NoSlidingExpiration,
|
||||
CacheItemPriority.NotRemovable, _onCacheRemove);
|
||||
}
|
||||
|
||||
|
||||
public void DoWork(string k, object v, CacheItemRemovedReason r)
|
||||
{
|
||||
Logger.Info("Tick!");
|
||||
StartTimer(Convert.ToInt32(v));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue