Skip to content

feat(request): @gocell/request http 实例设全局默认 timeout(防请求永久挂起) #67

Description

@ghbvf

背景

@gocell/request 的共享 axios 实例 packages/request/src/http.ts 用 axios.create() 创建,未设默认 timeout——任何请求遇后端 TCP 接受但不响应(挂起)时会永久 pending。

PR #65(#27)review(reviewer B,Cx2)指出:apps/web 的 bootstrapSession() 在 app.mount() 前 await 一次 POST /sessions/refresh,若该请求永久挂起 → app 永不挂载 → 永久白屏。

PR #65 已就 refresh 路径加 timeout: 10s 兜底(useAuthStore.refresh()),但其余所有请求(health 轮询、各列表端点、login/logout 等)仍无超时,全请求面的既有缺口未闭合。

范围

  • 在 packages/request/src/http.ts 的 axios.create({ timeout: <默认值> }) 设全局默认超时(建议 15s,可按端点覆盖)
  • 评估 useAuthStore.refresh() 里的 per-request timeout: 10s 是否可改为依赖全局默认(去重)
  • 评估是否有需要长超时/无超时的端点(如 SSE / 长轮询)需单独豁免
  • 补 http.spec.ts 超时行为单测

备注

非 #27 阻断项;#27 已在 refresh 路径兜底了最关键的 mount-blocking 场景。本 issue 收口全局缺口。

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    pkg/webapps/web 装配层priority/p3低优先级 / backlog

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions