Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Worker.Output Sendable #313

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion WorkflowCombine/Sources/Worker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Output>: AnyWorkflowConvertible where Rendering == Void {
public protocol Worker<Output>: AnyWorkflowConvertible where Rendering == Void, Output: Sendable {
/// The type of output events returned by this worker.
associatedtype Output
associatedtype WorkerPublisher: Publisher where
Expand Down
4 changes: 2 additions & 2 deletions WorkflowConcurrency/Sources/Worker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Output>: AnyWorkflowConvertible where Rendering == Void {
public protocol Worker<Output>: AnyWorkflowConvertible where Rendering == Void, Output: Sendable {
/// The type of output events returned by this worker.
associatedtype Output

Expand Down Expand Up @@ -63,7 +63,7 @@ struct WorkerWorkflow<WorkerType: Worker>: Workflow {
let logger = WorkerLogger<WorkerType>()
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()
Expand Down
2 changes: 1 addition & 1 deletion WorkflowReactiveSwift/Sources/Worker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Output>: AnyWorkflowConvertible where Rendering == Void {
public protocol Worker<Output>: AnyWorkflowConvertible where Rendering == Void, Output: Sendable {
/// The type of output events returned by this worker.
associatedtype Output

Expand Down
2 changes: 1 addition & 1 deletion WorkflowRxSwift/Sources/Worker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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<Output>: AnyWorkflowConvertible where Rendering == Void {
public protocol Worker<Output>: AnyWorkflowConvertible where Rendering == Void, Output: Sendable {
/// The type of output events returned by this worker.
associatedtype Output

Expand Down
Loading