We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent e547979 commit a096aeeCopy full SHA for a096aee
Amplify/Core/Support/TaskQueue.swift
@@ -12,11 +12,13 @@ public actor TaskQueue<Success> {
12
13
public init() {}
14
15
- public func sync(block: @Sendable @escaping () async throws -> Success) rethrows {
16
- previousTask = Task { [previousTask] in
+ public func sync(block: @Sendable @escaping () async throws -> Success) async throws -> Success {
+ let currentTask = Task { [previousTask] in
17
_ = await previousTask?.result
18
return try await block()
19
}
20
+ previousTask = currentTask
21
+ return try await currentTask.value
22
23
24
public nonisolated func async(block: @Sendable @escaping () async throws -> Success) rethrows {
0 commit comments