Skip to content

Commit da325d9

Browse files
committed
chore(rivetkit): note duplicate admission logic
1 parent cc49ff7 commit da325d9

3 files changed

Lines changed: 15 additions & 0 deletions

File tree

rivetkit-rust/packages/rivetkit-core/src/actor/task.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1160,6 +1160,7 @@ impl ActorTask {
11601160
}
11611161

11621162
fn dispatch_lifecycle_error(&self) -> Option<anyhow::Error> {
1163+
// TODO: Share admission policy with RegistryDispatcher::active_actor.
11631164
if self.ctx.destroy_requested() {
11641165
self.ctx.warn_work_sent_to_stopping_instance("dispatch");
11651166
return Some(ActorLifecycleError::Destroying.build());

rivetkit-rust/packages/rivetkit-core/src/registry/http.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,19 @@ pub(super) fn normalize_actor_request_path(path: &str) -> String {
625625
}
626626
}
627627

628+
#[cfg(test)]
629+
pub(super) fn is_actor_request_path(path: &str) -> bool {
630+
let Some(stripped) = path.strip_prefix("/request") else {
631+
return false;
632+
};
633+
634+
stripped.is_empty()
635+
|| stripped
636+
.as_bytes()
637+
.first()
638+
.is_some_and(|byte| matches!(byte, b'/' | b'?'))
639+
}
640+
628641
pub(super) fn build_envoy_response(response: Response) -> Result<HttpResponse> {
629642
let (status, headers, body) = response.to_parts();
630643

rivetkit-rust/packages/rivetkit-core/src/registry/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -808,6 +808,7 @@ impl RegistryDispatcher {
808808
match instance.get() {
809809
ActorInstanceState::Active(instance) => {
810810
let instance = instance.clone();
811+
// TODO: Share admission policy with ActorTask::dispatch_lifecycle_error.
811812
if instance.ctx.started() {
812813
if instance.ctx.destroy_requested() {
813814
instance

0 commit comments

Comments
 (0)