Skip to main content

run_task_from_worker_ctx

Function run_task_from_worker_ctx 

Source
pub async fn run_task_from_worker_ctx<T>(
    worker_context: WorkerContext,
) -> Result<(), String>
where T: TaskHandler,
Expand description

Internal function to execute a task handler from a worker context.

This function:

  1. Deserializes the job payload into the specified task handler type
  2. Calls the task handler’s run method
  3. Processes the result

§Arguments

  • worker_context - The context containing job information and payload

§Returns

  • Result<(), String> - Ok(()) on success, Err with error message on failure

§Type Parameters

  • T - The task handler type to deserialize and execute