mirror of
https://github.com/openai/codex.git
synced 2026-11-23 23:10:47 +00:00
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:
@@ -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> {
|
||||
|
||||
Reference in New Issue
Block a user