fix: async-ify login flow (#2393)
This replaces blocking I/O with async/non-blocking I/O in a number of cases. This facilitates the use of `tokio::sync::Notify` and `tokio::select!` in #2394. --- [//]: # (BEGIN SAPLING FOOTER) Stack created with [Sapling](https://sapling-scm.com). Best reviewed with [ReviewStack](https://reviewstack.dev/openai/codex/pull/2393). * #2399 * #2398 * #2396 * #2395 * #2394 * __->__ #2393 * #2389
This commit is contained in:
@@ -180,15 +180,9 @@ impl CodexMessageProcessor {
|
||||
let outgoing_clone = self.outgoing.clone();
|
||||
let active_login = self.active_login.clone();
|
||||
tokio::spawn(async move {
|
||||
let result =
|
||||
tokio::task::spawn_blocking(move || server.block_until_done()).await;
|
||||
let (success, error_msg) = match result {
|
||||
Ok(Ok(())) => (true, None),
|
||||
Ok(Err(err)) => (false, Some(format!("Login server error: {err}"))),
|
||||
Err(join_err) => (
|
||||
false,
|
||||
Some(format!("failed to join login server thread: {join_err}")),
|
||||
),
|
||||
let (success, error_msg) = match server.block_until_done().await {
|
||||
Ok(()) => (true, None),
|
||||
Err(err) => (false, Some(format!("Login server error: {err}"))),
|
||||
};
|
||||
let notification = LoginChatGptCompleteNotification {
|
||||
login_id,
|
||||
|
||||
Reference in New Issue
Block a user