diff --git a/packages/edge/api/actor/src/route/actors.rs b/packages/edge/api/actor/src/route/actors.rs index 94b420541b..a148f8bfe6 100644 --- a/packages/edge/api/actor/src/route/actors.rs +++ b/packages/edge/api/actor/src/route/actors.rs @@ -150,14 +150,14 @@ pub async fn create( tracing::info!(?actor_id, ?tags, "creating actor with tags"); - let create_fut = if network.wait_ready.unwrap_or_default() { + let allocated_fut = if network.wait_ready.unwrap_or_default() { std::future::pending().boxed() } else { - let mut create_sub = ctx - .subscribe::(("actor_id", actor_id)) + let mut allocated_sub = ctx + .subscribe::(("actor_id", actor_id)) .await?; - async move { create_sub.next().await }.boxed() + async move { allocated_sub.next().await }.boxed() }; let mut ready_sub = ctx .subscribe::(("actor_id", actor_id)) @@ -238,9 +238,9 @@ pub async fn create( .dispatch() .await?; - // Wait for create/ready, fail, or destroy + // Wait for allocated/ready, fail, or destroy tokio::select! { - res = create_fut => { res?; }, + res = allocated_fut => { res?; }, res = ready_sub.next() => { res?; }, res = fail_sub.next() => { let msg = res?; diff --git a/packages/edge/services/pegboard/src/workflows/actor/mod.rs b/packages/edge/services/pegboard/src/workflows/actor/mod.rs index 023628198a..4ab6833411 100644 --- a/packages/edge/services/pegboard/src/workflows/actor/mod.rs +++ b/packages/edge/services/pegboard/src/workflows/actor/mod.rs @@ -146,6 +146,13 @@ pub async fn pegboard_actor(ctx: &mut WorkflowCtx, input: &Input) -> GlobalResul return Ok(()); }; + ctx.v(2).msg(Allocated { + client_id: res.client_id, + }) + .tag("actor_id", input.actor_id) + .send() + .await?; + let state_res = ctx .loope( runtime::State::new(res.client_id, res.client_workflow_id, input.image_id), @@ -447,6 +454,11 @@ pub async fn pegboard_actor(ctx: &mut WorkflowCtx, input: &Input) -> GlobalResul #[message("pegboard_actor_create_complete")] pub struct CreateComplete {} +#[message("pegboard_actor_allocated")] +pub struct Allocated { + pub client_id: Uuid, +} + #[message("pegboard_actor_failed")] pub struct Failed { pub message: String,