Skip to content

Commit

Permalink
Changed Worker task priority to high (#306)
Browse files Browse the repository at this point in the history
  • Loading branch information
mjohnson12 authored Oct 7, 2024
1 parent 2c7ecdf commit dbc466b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion WorkflowConcurrency/Sources/Worker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public protocol Worker<Output>: AnyWorkflowConvertible where Rendering == Void {
associatedtype Output

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

0 comments on commit dbc466b

Please sign in to comment.