Skip to content

Conversation

@MasterPtato
Copy link
Contributor

Changes

@MasterPtato MasterPtato requested a review from NathanFlurry May 17, 2025 00:44
Copy link
Contributor Author

MasterPtato commented May 17, 2025


How to use the Graphite Merge Queue

Add the label merge-queue to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

This PR enhances WebSocket connection reliability in the guard service by modifying retry behavior and cache management.

  • Increased WebSocket retry attempts from 4 to 7 and decreased initial interval from 250ms to 150ms in packages/edge/infra/guard/server/src/main.rs
  • Added cache clearing during WebSocket retries in packages/edge/infra/guard/core/src/proxy_service.rs to ensure fresh routing on retry
  • Made target parameter mutable in handle_websocket_upgrade to allow route updates during retries
  • Removed outdated comments about retry configuration

2 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

Comment on lines +1216 to +1224
match new_target {
Ok(ResolveRouteOutput::Target(new_target)) => {
target = new_target;
}
Ok(ResolveRouteOutput::Response(_response)) => {
error!("Expected target, got response")
}
Err(e) => error!("Routing error: {}", e),
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Should propagate routing errors to client with appropriate close code rather than just logging

Suggested change
match new_target {
Ok(ResolveRouteOutput::Target(new_target)) => {
target = new_target;
}
Ok(ResolveRouteOutput::Response(_response)) => {
error!("Expected target, got response")
}
Err(e) => error!("Routing error: {}", e),
}
match new_target {
Ok(ResolveRouteOutput::Target(new_target)) => {
target = new_target;
}
Ok(ResolveRouteOutput::Response(_response)) => {
error!("Expected target, got response");
// Send close with internal error code
let _ = client_sink.send(hyper_tungstenite::tungstenite::Message::Close(Some(
hyper_tungstenite::tungstenite::protocol::CloseFrame {
code: 1011.into(), // Internal error
reason: "Routing error: unexpected response".into(),
}
))).await;
return;
}
Err(e) => {
error!("Routing error: {}", e);
// Send close with internal error code
let _ = client_sink.send(hyper_tungstenite::tungstenite::Message::Close(Some(
hyper_tungstenite::tungstenite::protocol::CloseFrame {
code: 1011.into(), // Internal error
reason: format!("Routing error: {}", e).into(),
}
))).await;
return;
}
}

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented May 17, 2025

Deploying rivet with  Cloudflare Pages  Cloudflare Pages

Latest commit: 63e9908
Status: ✅  Deploy successful!
Preview URL: https://5088259b.rivet.pages.dev
Branch Preview URL: https://graphite-base-2446.rivet.pages.dev

View logs

@NathanFlurry NathanFlurry force-pushed the 05-17-fix_guard_add_cache_clearing_to_ws_retry_increase_ws_retries branch from 5ae1f6e to 63e9908 Compare May 23, 2025 02:42
@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented May 23, 2025

Deploying rivet-studio with  Cloudflare Pages  Cloudflare Pages

Latest commit: 63e9908
Status: ✅  Deploy successful!
Preview URL: https://ee92d214.rivet-studio.pages.dev
Branch Preview URL: https://graphite-base-2446.rivet-studio.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link

Deploying rivet-studio with  Cloudflare Pages  Cloudflare Pages

Latest commit: 63e9908
Status:⚡️  Build in progress...

View logs

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented May 23, 2025

Deploying rivet-hub with  Cloudflare Pages  Cloudflare Pages

Latest commit: 63e9908
Status: ✅  Deploy successful!
Preview URL: https://c2b17a1c.rivet-hub-7jb.pages.dev
Branch Preview URL: https://graphite-base-2446.rivet-hub-7jb.pages.dev

View logs

@graphite-app
Copy link
Contributor

graphite-app bot commented May 23, 2025

Merge activity

  • May 23, 3:13 AM UTC: NathanFlurry added this pull request to the Graphite merge queue.
  • May 23, 3:14 AM UTC: CI is running for this pull request on a draft pull request (#2470) due to your merge queue CI optimization settings.
  • May 23, 3:15 AM UTC: Merged by the Graphite merge queue via draft PR: #2470.

graphite-app bot pushed a commit that referenced this pull request May 23, 2025
<!-- Please make sure there is an issue that this PR is correlated to. -->

## Changes

<!-- If there are frontend changes, please include screenshots. -->
@graphite-app graphite-app bot closed this May 23, 2025
@graphite-app graphite-app bot deleted the 05-17-fix_guard_add_cache_clearing_to_ws_retry_increase_ws_retries branch May 23, 2025 03:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants