From 71919dcc055b8ecb64aa18ff7dbdd1eaa4621649 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 11 Dec 2016 00:27:08 -0500 Subject: [PATCH] update components --- .../Data/BaseSqliteRepository.cs | 42 ------------------- .../Data/SqliteItemRepository.cs | 26 ++++++------ .../Data/SqliteUserDataRepository.cs | 4 +- 3 files changed, 15 insertions(+), 57 deletions(-) diff --git a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs index be5b4d006..8f2bb2cea 100644 --- a/Emby.Server.Implementations/Data/BaseSqliteRepository.cs +++ b/Emby.Server.Implementations/Data/BaseSqliteRepository.cs @@ -343,46 +343,4 @@ namespace Emby.Server.Implementations.Data return new WriteLockToken(obj); } } - - public static class SemaphpreSlimExtensions - { - private sealed class WriteLockToken : IDisposable - { - private SemaphoreSlim _sync; - public WriteLockToken(SemaphoreSlim sync) - { - _sync = sync; - var task = sync.WaitAsync(); - Task.WaitAll(task); - } - public void Dispose() - { - if (_sync != null) - { - _sync.Release(); - _sync = null; - } - } - } - - public class DummyToken : IDisposable - { - public void Dispose() - { - } - } - - public static IDisposable Read(this SemaphoreSlim obj) - { - return Write(obj); - } - public static IDisposable Write(this SemaphoreSlim obj) - { - //if (BaseSqliteRepository.ThreadSafeMode > 0) - //{ - // return new DummyToken(); - //} - return new WriteLockToken(obj); - } - } } diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs index 58fcf62d9..e3dd3f884 100644 --- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs @@ -1257,7 +1257,7 @@ namespace Emby.Server.Implementations.Data CheckDisposed(); //Logger.Info("Retrieving item {0}", id.ToString("N")); - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { @@ -2083,7 +2083,7 @@ namespace Emby.Server.Implementations.Data var list = new List(); - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { @@ -2117,7 +2117,7 @@ namespace Emby.Server.Implementations.Data throw new ArgumentNullException("id"); } - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { @@ -2492,7 +2492,7 @@ namespace Emby.Server.Implementations.Data } } - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { @@ -2687,7 +2687,7 @@ namespace Emby.Server.Implementations.Data statementTexts.Add(commandText); } - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { @@ -2906,7 +2906,7 @@ namespace Emby.Server.Implementations.Data var list = new List(); - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { @@ -2977,7 +2977,7 @@ namespace Emby.Server.Implementations.Data var list = new List>(); - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { @@ -3091,7 +3091,7 @@ namespace Emby.Server.Implementations.Data statementTexts.Add(commandText); } - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { @@ -4595,7 +4595,7 @@ namespace Emby.Server.Implementations.Data var list = new List(); - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { @@ -4636,7 +4636,7 @@ namespace Emby.Server.Implementations.Data var list = new List(); - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { @@ -4851,7 +4851,7 @@ namespace Emby.Server.Implementations.Data commandText += " Group By CleanValue"; - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { @@ -5030,7 +5030,7 @@ namespace Emby.Server.Implementations.Data statementTexts.Add(countText); } - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { @@ -5340,7 +5340,7 @@ namespace Emby.Server.Implementations.Data cmdText += " order by StreamIndex ASC"; - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { diff --git a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs index b113582ed..be59d71b3 100644 --- a/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs +++ b/Emby.Server.Implementations/Data/SqliteUserDataRepository.cs @@ -296,7 +296,7 @@ namespace Emby.Server.Implementations.Data throw new ArgumentNullException("key"); } - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection(true)) { @@ -349,7 +349,7 @@ namespace Emby.Server.Implementations.Data var list = new List(); - using (WriteLock.Write()) + using (WriteLock.Read()) { using (var connection = CreateConnection()) {