Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -270,4 +270,4 @@ Serverless, containers, or your own servers — Rivet Actors work with your exis

## License

[Apache 2.0](LICENSE)
[Apache 2.0](LICENSE)
167 changes: 64 additions & 103 deletions engine/artifacts/config-schema.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 22 additions & 12 deletions engine/packages/api-peer/src/actors/delete.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,36 @@ use rivet_util::Id;
)]
#[tracing::instrument(skip_all)]
pub async fn delete(ctx: ApiCtx, path: DeletePath, query: DeleteQuery) -> Result<DeleteResponse> {
// Get the actor first to verify it exists
let actors_res = ctx
.op(pegboard::ops::actor::get::Input {
// Subscribe before fetching actor data
let mut destroy_sub = ctx
.subscribe::<pegboard::workflows::actor::DestroyComplete>(("actor_id", path.actor_id))
.await?;

let (actors_res, namespace_res) = tokio::try_join!(
// Get the actor to verify it exists
ctx.op(pegboard::ops::actor::get::Input {
actor_ids: vec![path.actor_id],
fetch_error: false,
})
.await?;
}),
ctx.op(namespace::ops::resolve_for_name_global::Input {
name: query.namespace,
}),
)?;

let actor = actors_res
.actors
.into_iter()
.next()
.ok_or_else(|| pegboard::errors::Actor::NotFound.build())?;

// Verify the actor belongs to the specified namespace
let namespace = ctx
.op(namespace::ops::resolve_for_name_global::Input {
name: query.namespace,
})
.await?
.ok_or_else(|| namespace::errors::Namespace::NotFound.build())?;
// Already destroyed
if actor.destroy_ts.is_some() {
return Err(pegboard::errors::Actor::NotFound.build());
}

let namespace = namespace_res.ok_or_else(|| namespace::errors::Namespace::NotFound.build())?;

// Verify the actor belongs to the specified namespace
if actor.namespace_id != namespace.namespace_id {
return Err(pegboard::errors::Actor::NotFound.build());
}
Expand All @@ -56,6 +64,8 @@ pub async fn delete(ctx: ApiCtx, path: DeletePath, query: DeleteQuery) -> Result
actor_id=?path.actor_id,
"actor workflow not found, likely already stopped"
);
} else {
destroy_sub.next().await?;
}

Ok(DeleteResponse {})
Expand Down
2 changes: 1 addition & 1 deletion engine/packages/config/src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ impl Root {
}

// Validate force_shutdown_duration is greater than worker and guard shutdown durations
let worker = self.runtime.worker.shutdown_duration();
let worker = self.runtime.worker_shutdown_duration();
let guard = self.runtime.guard_shutdown_duration();
let force = self.runtime.force_shutdown_duration();
let max_graceful = worker.max(guard);
Expand Down
Loading
Loading