mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-20 00:55:13 +01:00
fix userdata transactions
This commit is contained in:
@@ -69,14 +69,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
|
||||
if (stream.IsTextSubtitleStream)
|
||||
{
|
||||
if (string.Equals(stream.Codec, "ass", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (string.Equals(stream.Codec, "ssa", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
{
|
||||
public abstract class BaseSqliteRepository : IDisposable
|
||||
{
|
||||
protected readonly SemaphoreSlim WriteLock = new SemaphoreSlim(1, 1);
|
||||
protected SemaphoreSlim WriteLock = new SemaphoreSlim(1, 1);
|
||||
protected readonly IDbConnector DbConnector;
|
||||
protected ILogger Logger;
|
||||
|
||||
|
||||
@@ -328,7 +328,7 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
new MediaStreamColumns(_connection, Logger).AddColumns();
|
||||
|
||||
DataExtensions.Attach(_connection, Path.Combine(_config.ApplicationPaths.DataPath, "userdata_v2.db"), "UserDataDb");
|
||||
await userDataRepo.Initialize(_connection).ConfigureAwait(false);
|
||||
await userDataRepo.Initialize(_connection, WriteLock).ConfigureAwait(false);
|
||||
//await Vacuum(_connection).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -56,8 +56,10 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
/// Opens the connection to the database
|
||||
/// </summary>
|
||||
/// <returns>Task.</returns>
|
||||
public async Task Initialize(IDbConnection connection)
|
||||
public async Task Initialize(IDbConnection connection, SemaphoreSlim writeLock)
|
||||
{
|
||||
WriteLock.Dispose();
|
||||
WriteLock = writeLock;
|
||||
_connection = connection;
|
||||
|
||||
string[] queries = {
|
||||
@@ -438,18 +440,14 @@ namespace MediaBrowser.Server.Implementations.Persistence
|
||||
return userData;
|
||||
}
|
||||
|
||||
protected override void Dispose(bool dispose)
|
||||
{
|
||||
// handled by library database
|
||||
}
|
||||
|
||||
protected override void CloseConnection()
|
||||
{
|
||||
if (_connection != null)
|
||||
{
|
||||
if (_connection.IsOpen())
|
||||
{
|
||||
_connection.Close();
|
||||
}
|
||||
|
||||
_connection.Dispose();
|
||||
_connection = null;
|
||||
}
|
||||
// handled by library database
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user