mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-17 06:23:03 +03:00
Back to a single connection
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using SQLitePCL.pretty;
|
||||
@@ -9,8 +8,7 @@ namespace Emby.Server.Implementations.Data
|
||||
public class ManagedConnection : IDisposable
|
||||
{
|
||||
private SQLiteDatabaseConnection _db;
|
||||
private SemaphoreSlim _writeLock;
|
||||
private BlockingCollection<SQLiteDatabaseConnection> _readConPool;
|
||||
private readonly SemaphoreSlim _writeLock;
|
||||
private bool _disposed = false;
|
||||
|
||||
public ManagedConnection(SQLiteDatabaseConnection db, SemaphoreSlim writeLock)
|
||||
@@ -19,12 +17,6 @@ namespace Emby.Server.Implementations.Data
|
||||
_writeLock = writeLock;
|
||||
}
|
||||
|
||||
public ManagedConnection(SQLiteDatabaseConnection db, BlockingCollection<SQLiteDatabaseConnection> queue)
|
||||
{
|
||||
_db = db;
|
||||
_readConPool = queue;
|
||||
}
|
||||
|
||||
public IStatement PrepareStatement(string sql)
|
||||
{
|
||||
return _db.PrepareStatement(sql);
|
||||
@@ -77,8 +69,7 @@ namespace Emby.Server.Implementations.Data
|
||||
return;
|
||||
}
|
||||
|
||||
_writeLock?.Release();
|
||||
_readConPool?.Add(_db);
|
||||
_writeLock.Release();
|
||||
|
||||
_db = null; // Don't dispose it
|
||||
_disposed = true;
|
||||
|
||||
Reference in New Issue
Block a user