Skip to content

Commit 94c5a4e

Browse files
committed
fix(guard): remove incorrect connectability check
1 parent f1c054d commit 94c5a4e

File tree

12 files changed

+49
-498
lines changed

12 files changed

+49
-498
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,14 @@ Public-facing projects:
4040

4141
- **Rivet Engine** (you are here): Engine that powers Rivet Actors at scale
4242
- **[RivetKit](https://github.com/rivet-gg/rivetkit)**: Lightweight TypeScript library for building Rivet Actors — works with Redis or Rivet Engine
43-
- **[Rivet Studio](/frontend/apps/studio)**: Like Postman, but for Rivet Actors
44-
- **[Rivet Hub](/frontend/apps/hub)**: UI for Rivet Engine
43+
- **[Rivet Hub](/frontend/)**: UI for Rivet Engine
4544
- **[Rivet Documentation](/site/src/content/docs)**
4645

4746
Projects powering Rivet Engine:
4847

49-
- **[Pegboard](packages/edge/services/pegboard/)**: Actor orchestrator
50-
- **[Guard](packages/edge/infra/guard/)**: Proxy for routing traffic to Rivet Actors
51-
- **[Chirp](packages/common/chirp-workflow/)**: Core workflow engine that powers Rivet
48+
- **[Pegboard](packages/services/pegboard/)**: Actor orchestrator
49+
- **[Guard](packages/core/guard/)**: Proxy for routing traffic to Rivet Actors
50+
- **[Gasoline](packages/common/gasoline/)**: Core durable execution engine that powers Rivet
5251

5352
## Get Started
5453

docker/template/grafana-dashboards/cache.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@
11701170
"timepicker": {},
11711171
"timezone": "browser",
11721172
"title": "Rivet Guard",
1173-
"uid": "cen785ige8fswd",
1173+
"uid": "cen785ige8fswd2",
11741174
"version": 1,
11751175
"weekStart": ""
1176-
}
1176+
}

packages/core/guard/server/src/routing/actor.rs

Lines changed: 0 additions & 247 deletions
This file was deleted.

packages/core/guard/server/src/routing/mod.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ use rivet_guard_core::RoutingFn;
77

88
use crate::errors;
99

10-
//pub(crate) mod actor;
1110
mod api_peer;
1211
mod api_public;
1312
pub mod pegboard_gateway;
@@ -36,12 +35,6 @@ pub fn create_routing_function(ctx: StandaloneCtx) -> RoutingFn {
3635
// Read target
3736
if let Some(target) = headers.get(X_RIVET_TARGET).and_then(|x| x.to_str().ok())
3837
{
39-
// if let Some(routing_output) =
40-
// actor::route_request(&ctx, target, host, path, headers).await?
41-
// {
42-
// return Ok(routing_output);
43-
// }
44-
4538
if let Some(routing_output) =
4639
runner_ws::route_request(&ctx, target, host, path).await?
4740
{

packages/core/guard/server/src/routing/pegboard_gateway.rs

Lines changed: 14 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -154,28 +154,20 @@ async fn find_actor(
154154
}
155155

156156
// Check if actor is connectable and get runner_id
157-
let runner_info = {
158-
let get_runner_fut = ctx.op(pegboard::ops::actor::get_runner::Input {
159-
actor_ids: vec![actor_id],
160-
});
161-
let output = tokio::time::timeout(Duration::from_secs(5), get_runner_fut).await??;
162-
output.actors.into_iter().find(|a| a.actor_id == actor_id)
163-
};
164-
165-
let Some(runner_info) = runner_info else {
166-
return Err(errors::ActorNotFound {
167-
actor_id,
168-
port_name: port_name.to_string(),
169-
}
170-
.build());
171-
};
172-
173-
if !runner_info.is_connectable {
157+
let get_runner_fut = ctx.op(pegboard::ops::actor::get_runner::Input {
158+
actor_ids: vec![actor_id],
159+
});
160+
let res = tokio::time::timeout(Duration::from_secs(5), get_runner_fut).await??;
161+
let runner_info = res.actors.into_iter().next().filter(|x| x.is_connectable);
162+
163+
let runner_id = if let Some(runner_info) = runner_info {
164+
runner_info.runner_id
165+
} else {
174166
tracing::info!(?actor_id, "waiting for actor to become ready");
175167

176168
// Wait for ready, fail, or destroy
177169
tokio::select! {
178-
res = ready_sub.next() => { res?; },
170+
res = ready_sub.next() => { res?.runner_id },
179171
res = fail_sub.next() => {
180172
let msg = res?;
181173
return Err(msg.error.clone().build());
@@ -185,45 +177,19 @@ async fn find_actor(
185177
return Err(pegboard::errors::Actor::DestroyedWhileWaitingForReady.build());
186178
}
187179
// Ready timeout
188-
_ = tokio::time::sleep(ACTOR_READY_TIMEOUT) => {
180+
_ = tokio::time::sleep(ACTOR_READY_TIMEOUT) => {
189181
return Err(errors::ActorReadyTimeout { actor_id }.build());
190182
}
191183
}
184+
};
192185

193-
// TODO: Is this needed? Can't we just re-check the actor exists if it fails to connect?
194-
// Verify actor is connectable again
195-
let runner_info = {
196-
let get_runner_fut = ctx.op(pegboard::ops::actor::get_runner::Input {
197-
actor_ids: vec![actor_id],
198-
});
199-
let output = tokio::time::timeout(Duration::from_secs(5), get_runner_fut).await??;
200-
output.actors.into_iter().find(|a| a.actor_id == actor_id)
201-
};
202-
203-
let Some(runner_info) = runner_info else {
204-
return Err(errors::ActorNotFound {
205-
actor_id,
206-
port_name: port_name.to_string(),
207-
}
208-
.build());
209-
};
210-
211-
if !runner_info.is_connectable {
212-
return Err(errors::ActorNotFound {
213-
actor_id,
214-
port_name: port_name.to_string(),
215-
}
216-
.build());
217-
};
218-
}
219-
220-
tracing::debug!(?actor_id, runner_id = ?runner_info.runner_id, "actor ready");
186+
tracing::debug!(?actor_id, ?runner_id, "actor ready");
221187

222188
// Return pegboard-gateway instance
223189
let gateway = pegboard_gateway::PegboardGateway::new(
224190
ctx.clone(),
225191
actor_id,
226-
runner_info.runner_id,
192+
runner_id,
227193
port_name.to_string(),
228194
);
229195
Ok(Some(RoutingOutput::CustomServe(std::sync::Arc::new(

0 commit comments

Comments
 (0)