Skip to content

MCP quota_status 每次调用重开 DB + 重发网络请求(含相对路径 CWD 依赖) #2

@Hailaylin

Description

@Hailaylin

严重度: 中等(预存问题,Claude 集成放大其影响)

文件: src/server/handlers/mod.rs (tool_quota_status, ~L562–587)

问题: 每次 MCP 调用都 QuotaOrchestrator::new() + fetch_all():重新打开/创建 DB(相对路径 quota.db,依赖 CWD)、重新发起所有 provider HTTP 请求(含 Claude OAuth 15s 超时)。与 serve-mode 缓存 AppState 隔离。

影响: 每次 MCP 调用耗时 15–30s 实时网络且不读缓存;相对路径在不同启动方式下可能指向错误位置。

建议: MCP handler 通过 AppState 读 DB 缓存(latest_*),不每次重新 fetch。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions