From c4aa053de94cfabc0a1a714ae760f168932a1d68 Mon Sep 17 00:00:00 2001 From: Jamie Rees Date: Fri, 29 Mar 2019 14:47:17 +0000 Subject: [PATCH] Removed the global lock --- .../Authentication/OmbiUserManager.cs | 2 +- src/Ombi.Helpers/GlobalMutex.cs | 38 ------------------- 2 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 src/Ombi.Helpers/GlobalMutex.cs diff --git a/src/Ombi.Core/Authentication/OmbiUserManager.cs b/src/Ombi.Core/Authentication/OmbiUserManager.cs index 6155672b3..2c78f39bf 100644 --- a/src/Ombi.Core/Authentication/OmbiUserManager.cs +++ b/src/Ombi.Core/Authentication/OmbiUserManager.cs @@ -158,7 +158,7 @@ namespace Ombi.Core.Authentication if (!email.Equals(result.User?.Email)) { user.Email = result.User?.Email; - await GlobalMutex.Lock(async () => await UpdateAsync(user)); + await UpdateAsync(user); } return true; diff --git a/src/Ombi.Helpers/GlobalMutex.cs b/src/Ombi.Helpers/GlobalMutex.cs deleted file mode 100644 index d7d3f7816..000000000 --- a/src/Ombi.Helpers/GlobalMutex.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using System.Threading; - -namespace Ombi.Helpers -{ - public static class GlobalMutex - { - public static T Lock(Func func) - { - const string mutexId = "Global\\OMBI"; - - using (var mutex = new Mutex(false, mutexId, out var __)) - { - var hasHandle = false; - try - { - try - { - hasHandle = mutex.WaitOne(5000, false); - if (hasHandle == false) - throw new TimeoutException("Timeout waiting for exclusive access"); - } - catch (AbandonedMutexException) - { - hasHandle = true; - } - - return func(); - } - finally - { - if (hasHandle) - mutex.ReleaseMutex(); - } - } - } - } -}