mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
fix: Hub 连接清理顺序修复、OAuth 类型常量提取、disassociate 逻辑优化
- Hub proxy/worker 连接关闭时先 unregister 再延迟 abort writer,确保缓冲消息排空 - 提取 OAUTH_AUTH_TYPES 常量,替代各处硬编码的 OAuth 类型列表 - auto-disassociate 跳过 OAuth Key,避免其动态 allowed_models 干扰判定 - 删除 Key 时传入 skip_disassociate=True,跳过不必要的解关联检查 - ModelMapper 缓存命中时将 ORM 实例脱离 Session,修复 DetachedInstanceError
This commit is contained in:
@@ -79,11 +79,16 @@ pub async fn handle_proxy_connection(
|
||||
.await;
|
||||
});
|
||||
|
||||
// Wait for reader to end, then cleanup writer/ping and unregister from hub.
|
||||
// Wait for reader to end, then cleanup.
|
||||
let _ = reader.await;
|
||||
ping_task.abort();
|
||||
writer.abort();
|
||||
hub.unregister_proxy(conn_id, &node_id);
|
||||
// conn still holds an Arc<ProxyConn> with a channel sender clone.
|
||||
// Drop it so the writer can drain and exit.
|
||||
drop(conn);
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
writer.abort();
|
||||
let _ = writer.await;
|
||||
}
|
||||
|
||||
async fn run_proxy_reader(
|
||||
|
||||
@@ -65,11 +65,17 @@ pub async fn handle_worker_connection(
|
||||
.await;
|
||||
});
|
||||
|
||||
// Wait for reader to end, then cleanup writer/ping and unregister from hub.
|
||||
// Wait for reader to end, then cleanup.
|
||||
let _ = reader.await;
|
||||
ping_task.abort();
|
||||
writer.abort();
|
||||
// Unregister first so all channel senders are dropped (reader_tx dropped
|
||||
// when reader completes, ping_tx dropped by abort, conn.tx dropped when
|
||||
// the last Arc<WorkerConn> is removed from hub). This lets the writer
|
||||
// drain buffered messages (e.g. GOAWAY) before we force-abort it.
|
||||
hub.unregister_worker(conn_id);
|
||||
tokio::time::sleep(Duration::from_millis(100)).await;
|
||||
writer.abort();
|
||||
let _ = writer.await;
|
||||
}
|
||||
|
||||
async fn run_worker_reader(
|
||||
|
||||
Reference in New Issue
Block a user