Box the runtime registration future (#63329)

## What changed

Return a boxed, `Send` future from `RuntimeRegistrationClient::register` so
callers use a shared, type-erased interface for the registration request. Allocate the
future only when registration is requested, leaving cached runtime lookups
free of that allocation.

GitOrigin-RevId: 721e36c3fbeb9d37a512ac4795d45bc9aead8031
This commit is contained in:
Charlie Marsh
2026-11-23 12:52:50 +00:00
committed by copyberry
parent 790ecc338a
commit 114c086d6d
@@ -10,6 +10,7 @@ use codex_http_client::RouteAwareClientPool;
use codex_http_client::RouteAwareRequestError;
use http::StatusCode;
use serde::Deserialize;
use std::pin::Pin;
use std::time::Duration;
use url::Url;
@@ -49,7 +50,19 @@ impl RuntimeRegistrationClient {
})
}
pub async fn register(
/// Share the registration request across callers. A cached runtime skips this allocation.
pub fn register<'a>(
&'a self,
registration: &'a RuntimeRegistration,
) -> Pin<
Box<
dyn Future<Output = Result<RuntimeRegistrationResponse, RegistrationError>> + Send + 'a,
>,
> {
Box::pin(self.register_inner(registration))
}
async fn register_inner(
&self,
registration: &RuntimeRegistration,
) -> Result<RuntimeRegistrationResponse, RegistrationError> {