mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 19:37:55 +02:00
Check for cancellation between each batch of MediaAttachment inserts.
This commit is contained in:
parent
74fb63a898
commit
6defe80b62
1 changed files with 4 additions and 2 deletions
|
@ -6226,13 +6226,13 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
|
|
||||||
db.Execute("delete from mediaattachments where ItemId=@ItemId", itemIdBlob);
|
db.Execute("delete from mediaattachments where ItemId=@ItemId", itemIdBlob);
|
||||||
|
|
||||||
InsertMediaAttachments(itemIdBlob, attachments, db);
|
InsertMediaAttachments(itemIdBlob, attachments, db, cancellationToken);
|
||||||
|
|
||||||
}, TransactionMode);
|
}, TransactionMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InsertMediaAttachments(byte[] idBlob, List<MediaAttachment> attachments, IDatabaseConnection db)
|
private void InsertMediaAttachments(byte[] idBlob, List<MediaAttachment> attachments, IDatabaseConnection db, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
var startIndex = 0;
|
var startIndex = 0;
|
||||||
var insertAtOnce = 10;
|
var insertAtOnce = 10;
|
||||||
|
@ -6263,6 +6263,8 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
|
||||||
insertText.Append(")");
|
insertText.Append(")");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
using (var statement = PrepareStatement(db, insertText.ToString()))
|
using (var statement = PrepareStatement(db, insertText.ToString()))
|
||||||
{
|
{
|
||||||
statement.TryBind("@ItemId", idBlob);
|
statement.TryBind("@ItemId", idBlob);
|
||||||
|
|
Loading…
Reference in a new issue