mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
- Rust proxy: 引入 snapshot+ACK 确认机制,心跳未确认时保留快照重发, 避免指标丢失;添加 heartbeat_session_id 防跨进程去重误判 - Hub transport: Redis SETNX 心跳去重,避免多 worker 重复写库; ACK 回显 heartbeat_id 供 Rust 端匹配 - ProxyNodeService.heartbeat: 改用 SQLAlchemy atomic update 原子累加 指标,避免 ORM read-modify-write 的并发覆盖问题 - 启动顺序修正: tunnel 状态重置移到 Hub 连接建立之前,避免竞态 - OAuth 批量导入: 动态超时(默认30s,走代理60s),Kiro 适配器透传 - 提取 normalize_heartbeat_id 到 tunnel_protocol 共享模块,消除重复
31 lines
1.1 KiB
Python
31 lines
1.1 KiB
Python
from __future__ import annotations
|
|
|
|
from src.api.admin.provider_oauth import (
|
|
_PROVIDER_OAUTH_BATCH_IMPORT_PROXY_TIMEOUT_SECONDS,
|
|
_PROVIDER_OAUTH_DEFAULT_TIMEOUT_SECONDS,
|
|
_resolve_batch_import_timeout_seconds,
|
|
)
|
|
|
|
|
|
def test_batch_import_timeout_without_proxy_uses_default() -> None:
|
|
assert _resolve_batch_import_timeout_seconds(None) == _PROVIDER_OAUTH_DEFAULT_TIMEOUT_SECONDS
|
|
assert (
|
|
_resolve_batch_import_timeout_seconds({"enabled": False})
|
|
== _PROVIDER_OAUTH_DEFAULT_TIMEOUT_SECONDS
|
|
)
|
|
|
|
|
|
def test_batch_import_timeout_with_proxy_uses_extended_value() -> None:
|
|
assert (
|
|
_resolve_batch_import_timeout_seconds({"node_id": "node-1", "enabled": True})
|
|
== _PROVIDER_OAUTH_BATCH_IMPORT_PROXY_TIMEOUT_SECONDS
|
|
)
|
|
assert (
|
|
_resolve_batch_import_timeout_seconds({"node_id": "node-1"})
|
|
== _PROVIDER_OAUTH_BATCH_IMPORT_PROXY_TIMEOUT_SECONDS
|
|
)
|
|
assert (
|
|
_resolve_batch_import_timeout_seconds("http://legacy-proxy") # type: ignore[arg-type]
|
|
== _PROVIDER_OAUTH_BATCH_IMPORT_PROXY_TIMEOUT_SECONDS
|
|
)
|