mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-20 15:55:25 +03:00
use individual connections
This commit is contained in:
@@ -9,13 +9,22 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
public abstract class BaseSqliteRepository : IDisposable
|
||||
{
|
||||
protected readonly SemaphoreSlim WriteLock = new SemaphoreSlim(1, 1);
|
||||
protected readonly IDbConnector DbConnector;
|
||||
protected ILogger Logger;
|
||||
|
||||
protected BaseSqliteRepository(ILogManager logManager)
|
||||
protected string DbFilePath { get; set; }
|
||||
|
||||
protected BaseSqliteRepository(ILogManager logManager, IDbConnector dbConnector)
|
||||
{
|
||||
DbConnector = dbConnector;
|
||||
Logger = logManager.GetLogger(GetType().Name);
|
||||
}
|
||||
|
||||
protected Task<IDbConnection> CreateConnection(bool isReadOnly = false)
|
||||
{
|
||||
return DbConnector.Connect(DbFilePath, false, true);
|
||||
}
|
||||
|
||||
private bool _disposed;
|
||||
protected void CheckDisposed()
|
||||
{
|
||||
@@ -84,6 +93,9 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void CloseConnection();
|
||||
protected virtual void CloseConnection()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user