aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Mahone <andrew.mahone@gmail.com>2019-11-07 08:38:36 -0500
committerAndrew Mahone <andrew.mahone@gmail.com>2019-11-07 08:38:36 -0500
commit6defe80b62483350111dc6ba2f18cfd83542c4b1 (patch)
treeb882766d4b22097feaf586654a19f7bea22e1fb2
parent74fb63a8989fe19c5e985a09f9cb45e42022320f (diff)
Check for cancellation between each batch of MediaAttachment inserts.
-rw-r--r--Emby.Server.Implementations/Data/SqliteItemRepository.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
index f7774000c..195671168 100644
--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs
+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs
@@ -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);
- InsertMediaAttachments(itemIdBlob, attachments, db);
+ InsertMediaAttachments(itemIdBlob, attachments, db, cancellationToken);
}, 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 insertAtOnce = 10;
@@ -6263,6 +6263,8 @@ where AncestorIdText not null and ItemValues.Value not null and ItemValues.Type
insertText.Append(")");
}
+ cancellationToken.ThrowIfCancellationRequested();
+
using (var statement = PrepareStatement(db, insertText.ToString()))
{
statement.TryBind("@ItemId", idBlob);