You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
932 B
39 lines
932 B
using MediaBrowser.Controller.Plugins;
|
|
using System;
|
|
using System.Threading;
|
|
|
|
namespace MediaBrowser.ServerApplication.EntryPoints
|
|
{
|
|
public class ResourceEntryPoint : IServerEntryPoint
|
|
{
|
|
private Timer _timer;
|
|
|
|
public void Run()
|
|
{
|
|
_timer = new Timer(TimerCallback, null, TimeSpan.FromMinutes(1), TimeSpan.FromMinutes(30));
|
|
}
|
|
|
|
private void TimerCallback(object state)
|
|
{
|
|
try
|
|
{
|
|
// Bad practice, i know. But we keep a lot in memory, unfortunately.
|
|
GC.Collect(2, GCCollectionMode.Forced, true);
|
|
GC.Collect(2, GCCollectionMode.Forced, true);
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
if (_timer != null)
|
|
{
|
|
_timer.Dispose();
|
|
_timer = null;
|
|
}
|
|
}
|
|
}
|
|
}
|