aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication/EntryPoints/ResourceEntryPoint.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.ServerApplication/EntryPoints/ResourceEntryPoint.cs')
-rw-r--r--MediaBrowser.ServerApplication/EntryPoints/ResourceEntryPoint.cs38
1 files changed, 38 insertions, 0 deletions
diff --git a/MediaBrowser.ServerApplication/EntryPoints/ResourceEntryPoint.cs b/MediaBrowser.ServerApplication/EntryPoints/ResourceEntryPoint.cs
new file mode 100644
index 000000000..e7a33d864
--- /dev/null
+++ b/MediaBrowser.ServerApplication/EntryPoints/ResourceEntryPoint.cs
@@ -0,0 +1,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;
+ }
+ }
+ }
+}