blob: e7a33d8644f44d6a196fa913947ee2c2e20453ae (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
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;
}
}
}
}
|