From 1db7b91fd90dc4ddb7bd5ad9b5f6f4079e16ccf0 Mon Sep 17 00:00:00 2001 From: Jacob Persson <7156+typfel@users.noreply.github.com> Date: Mon, 1 Jul 2024 11:34:07 +0200 Subject: [PATCH] fix: cancel all queued processing tasks when processing throws WPB-9221 (#1631) --- .../Source/Synchronization/EventProcessor.swift | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wire-ios-sync-engine/Source/Synchronization/EventProcessor.swift b/wire-ios-sync-engine/Source/Synchronization/EventProcessor.swift index f1d98b8b66c..9d8d92dd397 100644 --- a/wire-ios-sync-engine/Source/Synchronization/EventProcessor.swift +++ b/wire-ios-sync-engine/Source/Synchronization/EventProcessor.swift @@ -91,8 +91,10 @@ actor EventProcessor: UpdateEventProcessor { } private func enqueueTask(_ block: @escaping @Sendable () async throws -> Void) async throws { + defer { processingTask = nil } + processingTask = Task { [processingTask] in - _ = await processingTask?.result + _ = try await processingTask?.value return try await block() }