mirror of
https://github.com/openai/codex.git
synced 2026-11-12 14:41:42 +00:00
code-mode: Remove Session::is_alive() (#29732)
Remove this unused API. This API is insidious in that it implies that alive state should be determinable from the caller, and implies that a preflight should indicate routing. Lets drop this, and handle errors correctly from a failed session in the future.
This commit is contained in:
1 parent
bbbea91960
commit
db6e676afc
4 files changed
-15
No files matched your search
@@ -110,12 +110,6 @@ pub trait CodeModeSessionDelegate: Send + Sync {
|
|||||||
/// must keep those values isolated. Implementations may execute cells
|
/// must keep those values isolated. Implementations may execute cells
|
||||||
/// in-process or remotely.
|
/// in-process or remotely.
|
||||||
pub trait CodeModeSession: Send + Sync {
|
pub trait CodeModeSession: Send + Sync {
|
||||||
/// Returns whether the session can still accept requests.
|
|
||||||
///
|
|
||||||
/// Remote implementations should return `false` after their underlying
|
|
||||||
/// connection fails so callers can create a fresh session for later work.
|
|
||||||
fn is_alive(&self) -> bool;
|
|
||||||
|
|
||||||
fn execute<'a>(
|
fn execute<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
request: ExecuteRequest,
|
request: ExecuteRequest,
|
||||||
|
|||||||
@@ -216,10 +216,6 @@ impl Default for InProcessCodeModeSession {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CodeModeSession for InProcessCodeModeSession {
|
impl CodeModeSession for InProcessCodeModeSession {
|
||||||
fn is_alive(&self) -> bool {
|
|
||||||
self.runtime.is_alive()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn execute<'a>(
|
fn execute<'a>(
|
||||||
&'a self,
|
&'a self,
|
||||||
request: ExecuteRequest,
|
request: ExecuteRequest,
|
||||||
|
|||||||
@@ -63,10 +63,6 @@ impl<D: SessionRuntimeDelegate> SessionRuntime<D> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn is_alive(&self) -> bool {
|
|
||||||
!self.inner.shutdown_token.is_cancelled()
|
|
||||||
}
|
|
||||||
|
|
||||||
pub(crate) async fn execute(
|
pub(crate) async fn execute(
|
||||||
&self,
|
&self,
|
||||||
request: CreateCellRequest,
|
request: CreateCellRequest,
|
||||||
|
|||||||
@@ -152,7 +152,6 @@ async fn shutdown_rejects_cell_admission_queued_before_the_registry_lock() {
|
|||||||
})
|
})
|
||||||
.await;
|
.await;
|
||||||
|
|
||||||
assert!(!runtime.is_alive());
|
|
||||||
drop(cells);
|
drop(cells);
|
||||||
assert!(matches!(execution.await, Err(Error::ShuttingDown)));
|
assert!(matches!(execution.await, Err(Error::ShuttingDown)));
|
||||||
assert_eq!(shutdown.await, Ok(()));
|
assert_eq!(shutdown.await, Ok(()));
|
||||||
|
|||||||
Reference in new issue
Block a user