diff options
Diffstat (limited to 'MediaBrowser.ServerApplication')
| -rw-r--r-- | MediaBrowser.ServerApplication/EntryPoints/ResourceEntryPoint.cs | 38 | ||||
| -rw-r--r-- | MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj | 4 |
2 files changed, 40 insertions, 2 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; + } + } + } +} diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 9482351fb..e02bb1d69 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -131,8 +131,7 @@ <SpecificVersion>False</SpecificVersion> <HintPath>..\packages\MediaBrowser.IsoMounting.3.0.65\lib\net45\pfmclrapi.dll</HintPath> </Reference> - <Reference Include="ServiceStack.Interfaces, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL"> - <SpecificVersion>False</SpecificVersion> + <Reference Include="ServiceStack.Interfaces"> <HintPath>..\ThirdParty\ServiceStack\ServiceStack.Interfaces.dll</HintPath> </Reference> <Reference Include="SimpleInjector, Version=2.3.6.0, Culture=neutral, PublicKeyToken=984cb50dea722e99, processorArchitecture=MSIL"> @@ -161,6 +160,7 @@ <Compile Include="BackgroundService.cs"> <SubType>Component</SubType> </Compile> + <Compile Include="EntryPoints\ResourceEntryPoint.cs" /> <Compile Include="EntryPoints\StartupWizard.cs" /> <Compile Include="FFMpeg\FFMpegDownloadInfo.cs" /> <Compile Include="FFMpeg\FFMpegInfo.cs" /> |
