add global mutex to ensure single instance (#1324)

This commit is contained in:
Jason Dove
2023-06-24 06:30:55 -05:00
committed by GitHub
parent c128f72a54
commit 0d66f752b6
2 changed files with 10 additions and 0 deletions
+3
View File
@@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- Only allow a single instance of ErsatzTV to run
- This fixes some cases where the search index would become unusable
## [0.8.0-beta] - 2023-06-23
### Added
+7
View File
@@ -43,6 +43,13 @@ public class Program
public static async Task<int> Main(string[] args)
{
using var _ = new Mutex(true, "Global\\ErsatzTV.Singleton.74360cd8985c4d1fb6bc9e81887206fe", out bool createdNew);
if (!createdNew)
{
Console.WriteLine("Another instance of ErsatztTV is already running.");
return 1;
}
LoggingLevelSwitch.MinimumLevel = LogEventLevel.Information;
LoggerConfiguration loggerConfiguration = new LoggerConfiguration()