diff options
| author | Cody Robibero <cody@robibe.ro> | 2023-05-04 12:33:46 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-04 12:33:46 -0600 |
| commit | aaddc5a33e5f64c7a36eede3c76f561d00b0c7b2 (patch) | |
| tree | a5a75dda01261eced7cdb4baa2e2187dfcb4473b /Emby.Server.Implementations/Data/ManagedConnection.cs | |
| parent | 5e2a1fb4478d5324961a3f822a1057628e75d2a8 (diff) | |
| parent | 8e1f0d53c1efe286628a4119b3c595f219513d23 (diff) | |
Merge pull request #9643 from Bond-009/sqlconnectionpool
Diffstat (limited to 'Emby.Server.Implementations/Data/ManagedConnection.cs')
| -rw-r--r-- | Emby.Server.Implementations/Data/ManagedConnection.cs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Emby.Server.Implementations/Data/ManagedConnection.cs b/Emby.Server.Implementations/Data/ManagedConnection.cs index 11e33278d..e84ed8f91 100644 --- a/Emby.Server.Implementations/Data/ManagedConnection.cs +++ b/Emby.Server.Implementations/Data/ManagedConnection.cs @@ -2,23 +2,22 @@ using System; using System.Collections.Generic; -using System.Threading; using SQLitePCL.pretty; namespace Emby.Server.Implementations.Data { public sealed class ManagedConnection : IDisposable { - private readonly SemaphoreSlim _writeLock; + private readonly ConnectionPool _pool; - private SQLiteDatabaseConnection? _db; + private SQLiteDatabaseConnection _db; private bool _disposed = false; - public ManagedConnection(SQLiteDatabaseConnection db, SemaphoreSlim writeLock) + public ManagedConnection(SQLiteDatabaseConnection db, ConnectionPool pool) { _db = db; - _writeLock = writeLock; + _pool = pool; } public IStatement PrepareStatement(string sql) @@ -73,9 +72,9 @@ namespace Emby.Server.Implementations.Data return; } - _writeLock.Release(); + _pool.Return(_db); - _db = null; // Don't dispose it + _db = null!; // Don't dispose it _disposed = true; } } |
