@@ -14,7 +14,7 @@ use rivet_metrics::KeyValue;
1414use rivet_util:: Id ;
1515use serde_json;
1616
17- use pegboard :: tunnel :: id :: { RequestId , generate_request_id } ;
17+ use rivet_runner_protocol as protocol ;
1818use std:: {
1919 borrow:: Cow ,
2020 collections:: { HashMap as StdHashMap , HashSet } ,
@@ -350,7 +350,7 @@ pub struct ProxyState {
350350 route_cache : RouteCache ,
351351 rate_limiters : Cache < ( Id , std:: net:: IpAddr ) , Arc < Mutex < RateLimiter > > > ,
352352 in_flight_counters : Cache < ( Id , std:: net:: IpAddr ) , Arc < Mutex < InFlightCounter > > > ,
353- inflight_requests : Arc < Mutex < HashSet < RequestId > > > ,
353+ in_flight_requests : Arc < Mutex < HashSet < protocol :: RequestId > > > ,
354354 port_type : PortType ,
355355 clickhouse_inserter : Option < clickhouse_inserter:: ClickHouseInserterHandle > ,
356356 tasks : Arc < TaskGroup > ,
@@ -379,7 +379,7 @@ impl ProxyState {
379379 . max_capacity ( 10_000 )
380380 . time_to_live ( PROXY_STATE_CACHE_TTL )
381381 . build ( ) ,
382- inflight_requests : Arc :: new ( Mutex :: new ( HashSet :: new ( ) ) ) ,
382+ in_flight_requests : Arc :: new ( Mutex :: new ( HashSet :: new ( ) ) ) ,
383383 port_type,
384384 clickhouse_inserter,
385385 tasks : TaskGroup :: new ( ) ,
@@ -603,7 +603,7 @@ impl ProxyState {
603603 ip_addr : std:: net:: IpAddr ,
604604 actor_id : & Option < Id > ,
605605 headers : & hyper:: HeaderMap ,
606- ) -> Result < Option < RequestId > > {
606+ ) -> Result < Option < protocol :: RequestId > > {
607607 // Check in-flight limit if actor_id is present
608608 if let Some ( actor_id) = * actor_id {
609609 // Get actor-specific middleware config
@@ -648,7 +648,7 @@ impl ProxyState {
648648 & self ,
649649 ip_addr : std:: net:: IpAddr ,
650650 actor_id : & Option < Id > ,
651- request_id : RequestId ,
651+ request_id : protocol :: RequestId ,
652652 ) {
653653 // Release in-flight counter if actor_id is present
654654 if let Some ( actor_id) = * actor_id {
@@ -660,17 +660,17 @@ impl ProxyState {
660660 }
661661
662662 // Release request ID
663- let mut requests = self . inflight_requests . lock ( ) . await ;
663+ let mut requests = self . in_flight_requests . lock ( ) . await ;
664664 requests. remove ( & request_id) ;
665665 }
666666
667667 /// Generate a unique request ID that is not currently in flight
668- async fn generate_unique_request_id ( & self ) -> anyhow :: Result < RequestId > {
668+ async fn generate_unique_request_id ( & self ) -> Result < protocol :: RequestId > {
669669 const MAX_TRIES : u32 = 100 ;
670- let mut requests = self . inflight_requests . lock ( ) . await ;
670+ let mut requests = self . in_flight_requests . lock ( ) . await ;
671671
672672 for attempt in 0 ..MAX_TRIES {
673- let request_id = generate_request_id ( ) ;
673+ let request_id = protocol :: util :: generate_request_id ( ) ;
674674
675675 // Check if this ID is already in use
676676 if !requests. contains ( & request_id) {
@@ -688,7 +688,7 @@ impl ProxyState {
688688 ) ;
689689 }
690690
691- anyhow :: bail!(
691+ bail ! (
692692 "failed to generate unique request id after {} attempts" ,
693693 MAX_TRIES
694694 ) ;
@@ -2144,7 +2144,7 @@ impl ProxyService {
21442144 . release_in_flight ( client_ip, & actor_id, request_id)
21452145 . await ;
21462146
2147- anyhow :: Ok ( ( ) )
2147+ Ok ( ( ) )
21482148 }
21492149 . instrument ( tracing:: info_span!( "handle_ws_task_custom_serve" ) ) ,
21502150 ) ;
0 commit comments