From 326a9d5dbcc2726d2765d05d6062ef1ab7feb8dd Mon Sep 17 00:00:00 2001 From: Steven Grosmark Date: Sat, 26 Oct 2024 16:48:09 -0400 Subject: [PATCH] Make Worker.Output Sendable --- WorkflowCombine/Sources/Worker.swift | 2 +- WorkflowConcurrency/Sources/Worker.swift | 4 ++-- WorkflowReactiveSwift/Sources/Worker.swift | 2 +- WorkflowRxSwift/Sources/Worker.swift | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/WorkflowCombine/Sources/Worker.swift b/WorkflowCombine/Sources/Worker.swift index bf177e2de..15b136daa 100644 --- a/WorkflowCombine/Sources/Worker.swift +++ b/WorkflowCombine/Sources/Worker.swift @@ -28,7 +28,7 @@ import Workflow /// If there is, and if the workers are 'equivalent', the context leaves the existing worker running. /// /// If there is not an existing worker of this type, the context will kick off the new worker (via `run`). -public protocol Worker: AnyWorkflowConvertible where Rendering == Void { +public protocol Worker: AnyWorkflowConvertible where Rendering == Void, Output: Sendable { /// The type of output events returned by this worker. associatedtype Output associatedtype WorkerPublisher: Publisher where diff --git a/WorkflowConcurrency/Sources/Worker.swift b/WorkflowConcurrency/Sources/Worker.swift index 4112b70e5..5ff220b29 100644 --- a/WorkflowConcurrency/Sources/Worker.swift +++ b/WorkflowConcurrency/Sources/Worker.swift @@ -25,7 +25,7 @@ import Workflow /// If there is, and if the workers are 'equivalent', the context leaves the existing worker running. /// /// If there is not an existing worker of this type, the context will kick off the new worker (via `run`). -public protocol Worker: AnyWorkflowConvertible where Rendering == Void { +public protocol Worker: AnyWorkflowConvertible where Rendering == Void, Output: Sendable { /// The type of output events returned by this worker. associatedtype Output @@ -63,7 +63,7 @@ struct WorkerWorkflow: Workflow { let logger = WorkerLogger() let sink = context.makeOutputSink() context.runSideEffect(key: state) { lifetime in - let send: @MainActor(Output) -> Void = sink.send + let send: @MainActor (Output) -> Void = sink.send let task = Task(priority: .high) { logger.logStarted() let output = await worker.run() diff --git a/WorkflowReactiveSwift/Sources/Worker.swift b/WorkflowReactiveSwift/Sources/Worker.swift index 1360a70a5..b0d728225 100644 --- a/WorkflowReactiveSwift/Sources/Worker.swift +++ b/WorkflowReactiveSwift/Sources/Worker.swift @@ -26,7 +26,7 @@ import Workflow /// If there is, and if the workers are 'equivalent', the context leaves the existing worker running. /// /// If there is not an existing worker of this type, the context will kick off the new worker (via `run`). -public protocol Worker: AnyWorkflowConvertible where Rendering == Void { +public protocol Worker: AnyWorkflowConvertible where Rendering == Void, Output: Sendable { /// The type of output events returned by this worker. associatedtype Output diff --git a/WorkflowRxSwift/Sources/Worker.swift b/WorkflowRxSwift/Sources/Worker.swift index c06b9d909..89bc12364 100644 --- a/WorkflowRxSwift/Sources/Worker.swift +++ b/WorkflowRxSwift/Sources/Worker.swift @@ -26,7 +26,7 @@ import Workflow /// If there is, and if the workers are 'equivalent', the context leaves the existing worker running. /// /// If there is not an existing worker of this type, the context will kick off the new worker (via `run`). -public protocol Worker: AnyWorkflowConvertible where Rendering == Void { +public protocol Worker: AnyWorkflowConvertible where Rendering == Void, Output: Sendable { /// The type of output events returned by this worker. associatedtype Output