Skip to main content

invoke_function_async

Function invoke_function_async 

Source
pub async fn invoke_function_async(
    __arg0: State<Arc<AppState>>,
    __arg1: Path<Uuid>,
    tenant: Option<Extension<TenantId>>,
    auth: Option<Extension<AuthContext>>,
    payload: Result<Json<InvokeRequest>, JsonRejection>,
) -> ApiResult<(StatusCode, Json<Value>)>
Expand description

POST /functions/{id}/invoke-async — fire-and-forget invocation.

Records a Pending JobRecord, spawns the spawn/call/terminate flow onto a Tokio task, and returns 202 Accepted with the job id. The task updates the registry to Completed (with the JSON result) or Failed (with {kind, message}) on conclusion. Callers poll via GET /jobs/{id}.

Body schema mirrors invoke_function: optional export / args (InvokeRequest). The body is parsed synchronously before the Tokio task spawn so 400 invalid_args surfaces synchronously (rather than as a JobStatus::Failed poll result).