Merge pull request #1797 from groue/dev/cancellation-fix

Fix race condition regarding Task cancellation
This commit is contained in:
Gwendal Roué authored and GitHub committed 2025-07-23 13:24:52 +02:00
commit 1622b72b62
2 files changed
+2

No files matched your search

+1
View File
@@ -803,6 +803,7 @@ extension DatabasePool: DatabaseWriter {
try Task.checkCancellation()
return try writer.sync { db in
defer {
cancelMutex.store(nil)
db.uncancel()
}
cancelMutex.store(db.cancel)
+1
View File
@@ -256,6 +256,7 @@ final class SerializedDatabase {
return try await withTaskCancellationHandler {
try await actor.execute {
defer {
cancelMutex.store(nil)
db.uncancel()
preconditionNoUnsafeTransactionLeft(db)
}