Skip to content

Commit dbc466b

Browse files
authored
Changed Worker task priority to high (#306)
1 parent 2c7ecdf commit dbc466b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: WorkflowConcurrency/Sources/Worker.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public protocol Worker<Output>: AnyWorkflowConvertible where Rendering == Void {
3030
associatedtype Output
3131

3232
/// Execute the work represented by this worker asynchronously and return the result.
33+
/// This function will be run in a Task set to high priority.
3334
func run() async -> Output
3435
/// Returns `true` if the other worker should be considered equivalent to `self`. Equivalence should take into
3536
/// account whatever data is meaningful to the task. For example, a worker that loads a user account from a server
@@ -63,7 +64,7 @@ struct WorkerWorkflow<WorkerType: Worker>: Workflow {
6364
let sink = context.makeOutputSink()
6465
context.runSideEffect(key: state) { lifetime in
6566
let send: @MainActor(Output) -> Void = sink.send
66-
let task = Task {
67+
let task = Task(priority: .high) {
6768
logger.logStarted()
6869
let output = await worker.run()
6970
if Task.isCancelled {

0 commit comments

Comments
 (0)