Browse Source

fix: key singleton mutex on config folder (#2946)

* fix: key singleton mutex on config folder

* update changelog

---------

Co-authored-by: Jason Dove <1695733+jasongdove@users.noreply.github.com>
pull/2951/head
Josh Martin 2 weeks ago committed by GitHub
parent
commit
16e341d9b5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 9
      ErsatzTV/Program.cs

1
CHANGELOG.md

@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -12,6 +12,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Playlists ignored this setting in earlier builds
- Always randomize start points for all collections the first time they are used
- Previously, only collections scheduled during the first day of a playout build had their start points randomized
- Allow multiple ETV instances when multiple config folders are used
## [26.6.0] - 2026-07-09
### Added

9
ErsatzTV/Program.cs

@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
using System.Diagnostics;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using Destructurama;
using ErsatzTV.Core;
using ErsatzTV.Services.Validators;
@ -47,9 +49,14 @@ public class Program @@ -47,9 +49,14 @@ public class Program
public static async Task<int> Main(string[] args)
{
// Keyed on the config folder, not a constant, so an instance running against an
// isolated ETV_CONFIG_FOLDER (a staging copy) can coexist with the primary one.
string singletonId = Convert.ToHexString(
SHA256.HashData(Encoding.UTF8.GetBytes(FileSystemLayout.AppDataFolder)))[..16];
using var _ = new Mutex(
true,
"Global\\ErsatzTV.Singleton.74360cd8985c4d1fb6bc9e81887206fe",
$"Global\\ErsatzTV.Singleton.{singletonId}",
out bool createdNew);
if (!createdNew)
{

Loading…
Cancel
Save