Browse Source

add global mutex to ensure single instance (#1324)

pull/1325/head
Jason Dove 2 years ago committed by GitHub
parent
commit
0d66f752b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      CHANGELOG.md
  2. 7
      ErsatzTV/Program.cs

3
CHANGELOG.md

@ -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/). The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased] ## [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 ## [0.8.0-beta] - 2023-06-23
### Added ### Added

7
ErsatzTV/Program.cs

@ -43,6 +43,13 @@ public class Program
public static async Task<int> Main(string[] args) 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; LoggingLevelSwitch.MinimumLevel = LogEventLevel.Information;
LoggerConfiguration loggerConfiguration = new LoggerConfiguration() LoggerConfiguration loggerConfiguration = new LoggerConfiguration()

Loading…
Cancel
Save