Skip to content
Merged
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
8 changes: 6 additions & 2 deletions WorkflowConcurrency/Sources/AsyncSequenceWorker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,12 @@ struct AsyncSequenceWorkerWorkflow<WorkerType: AsyncSequenceWorker>: Workflow {
context.runSideEffect(key: state) { lifetime in
let sequence = worker.run()
let task = Task { @MainActor in
for try await output in sequence {
sink.send(AnyWorkflowAction(sendingOutput: output))
do {
for try await output in sequence {
sink.send(AnyWorkflowAction(sendingOutput: output))
}
} catch {
fatalError("AsyncSequenceWorker implementations should not throw errors on iteration: \(error)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it be possible to add where Sequence.Failure == Never to the associatedtype declaration to codify that we expect a worker's run function to return a sequence that never fails?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No because Failure is iOS 18+ on AsyncSequence. We did try that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ugh. that sucks. saw the comment about the any AsyncSequence<Element, Failure> but thought maybe that was something else

}
}

Expand Down
Loading