Skip to content

fix(k8s): 修正 fetch 超时配置单位#1284

Open
qhongchen wants to merge 1 commit into
ding113:mainfrom
qhongchen:bugfix/fix-k8s-fetch-timeout-ms
Open

fix(k8s): 修正 fetch 超时配置单位#1284
qhongchen wants to merge 1 commit into
ding113:mainfrom
qhongchen:bugfix/fix-k8s-fetch-timeout-ms

Conversation

@qhongchen

@qhongchen qhongchen commented Jun 22, 2026

Copy link
Copy Markdown

Summary

Corrects the timeout configuration units in the K8s deployment manifest to match the application's millisecond-based expectations (undici interprets all timeout values in milliseconds).

Problem

The K8s deployment manifest configured undici timeout values incorrectly:

This caused a high probability of 503 errors in K8s deployments because connections would timeout before upstream providers could respond.

Related Issues/PRs:

Solution

Updates deploy/k8s/app/deployment.yaml to use correct millisecond-based values that match .env.example and src/lib/config/env.schema.ts:

  • FETCH_CONNECT_TIMEOUT: "30""30000" (30 seconds in milliseconds)
  • FETCH_HEADERS_TIMEOUT: uncommented with "600000" (600 seconds in milliseconds)
  • FETCH_BODY_TIMEOUT: uncommented with "600000" (600 seconds in milliseconds)

Changes

Core Changes

  • deploy/k8s/app/deployment.yaml — Fixed all three fetch timeout environment variables to use correct millisecond values

Testing

Manual Testing

  1. Deploy with the updated manifest
  2. Verify undici logs show correct timeout values (30000, 600000, 600000) instead of the incorrect values (30, 600, 600)
  3. Confirm LLM requests complete without premature timeout errors

Checklist

  • Code follows project conventions
  • Self-review completed

Description enhanced by Claude AI

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c4becfa4-de72-4527-b375-0f425eaac313

📥 Commits

Reviewing files that changed from the base of the PR and between f96d00f and e19dc3e.

📒 Files selected for processing (1)
  • deploy/k8s/app/deployment.yaml

📝 Walkthrough

Walkthrough

deploy/k8s/app/deployment.yaml 中,将 FETCH_CONNECT_TIMEOUT 的值从 "30" 更新为毫秒单位的 "30000",并启用此前被注释掉的 FETCH_HEADERS_TIMEOUTFETCH_BODY_TIMEOUT(均设为 "600000"),同时新增注释说明超时单位为毫秒。

Changes

Fetch 超时配置更新

Layer / File(s) Summary
Fetch 超时环境变量调整
deploy/k8s/app/deployment.yaml
FETCH_CONNECT_TIMEOUT 改为 "30000"(毫秒),FETCH_HEADERS_TIMEOUTFETCH_BODY_TIMEOUT 从注释状态启用并均设为 "600000",新增注释说明单位为毫秒。

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

  • ding113/claude-code-hub#1174: 同样修改 deploy/k8s/app/deployment.yaml 中的 Fetch 超时环境变量,涉及相同的 FETCH_HEADERS_TIMEOUTFETCH_BODY_TIMEOUTFETCH_CONNECT_TIMEOUT 字段。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed PR标题清晰地反映了主要改动:修正了Kubernetes部署中fetch超时配置的单位问题,与代码变更内容完全对应。
Description check ✅ Passed PR描述准确阐述了变更的背景和目标:解决k8s部署中因超时时间过短导致503错误的问题,与实际的配置调整相关。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Kubernetes deployment configuration by setting explicit millisecond values for fetch timeout environment variables (FETCH_CONNECT_TIMEOUT, FETCH_HEADERS_TIMEOUT, and FETCH_BODY_TIMEOUT). The reviewer points out that these values duplicate the default configurations in the application schema, creating redundancy and a risk of configuration drift. Additionally, the reviewer notes that the added comment incorrectly references .env.example, where these variables are not present, and suggests keeping these environment variables commented out in the deployment manifest unless customization is required.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment on lines +60 to +66
# Fetch 超时单位为毫秒,需与 .env.example 和 env.schema.ts 保持一致。
- name: FETCH_CONNECT_TIMEOUT
value: "30"
#- name: FETCH_HEADERS_TIMEOUT
# value: "600"
#- name: FETCH_BODY_TIMEOUT
# value: "600"
value: "30000"
- name: FETCH_HEADERS_TIMEOUT
value: "600000"
- name: FETCH_BODY_TIMEOUT
value: "600000"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

问题分析

  1. 配置冗余与漂移风险:这些环境变量的值(30000600000600000)与 src/lib/config/env.schema.ts 中定义的默认值完全一致。在 Kubernetes 部署中显式设置这些默认值会导致配置冗余。如果未来在代码中调整了默认超时时间,而忘记同步更新 Kubernetes 清单,就会导致配置漂移。
  2. 注释描述不准确:注释中提到“需与 .env.example 保持一致”,但实际上 deploy/.env.example 文件中并没有包含这些 FETCH_* 相关的环境变量。

改进建议

建议将这些配置项注释掉,仅作为自定义参考保留。这样既能利用代码中的默认值,避免配置漂移,又能在需要自定义超时时间时方便运维人员修改。同时修正注释中关于 .env.example 的不准确描述。

            # Fetch 超时配置(单位为毫秒)。默认值已在 env.schema.ts 中定义,此处注释以供参考或自定义。
            # - name: FETCH_CONNECT_TIMEOUT
            #   value: "30000"
            # - name: FETCH_HEADERS_TIMEOUT
            #   value: "600000"
            # - name: FETCH_BODY_TIMEOUT
            #   value: "600000"

@github-actions github-actions Bot added bug Something isn't working area:deployment labels Jun 22, 2026
@github-actions github-actions Bot added the size/XS Extra Small PR (< 50 lines) label Jun 22, 2026

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

This PR fixes a critical configuration bug in the Kubernetes deployment where fetch timeout values were incorrectly specified in seconds instead of milliseconds, causing 503 errors. The fix correctly updates the values to match the expected milliseconds unit used in .env.example.

PR Size: XS

  • Lines changed: 11 (6 additions, 5 deletions)
  • Files changed: 1 (deploy/k8s/app/deployment.yaml)

Issues Found

Category Critical High Medium Low
Logic/Bugs 0 0 0 0
Security 0 0 0 0
Error Handling 0 0 0 0
Types 0 0 0 0
Comments/Docs 0 0 0 0
Tests 0 0 0 0
Simplification 0 0 0 0

Review Notes

Process Note (Non-blocking): This PR targets main branch, while CLAUDE.md specifies that all PRs should target dev. Given this is a hotfix for a production issue (503 errors), targeting main may be intentional. Consider whether this should merge to dev first per the standard workflow.

Configuration Validation:

  • FETCH_CONNECT_TIMEOUT: 30 → 30000 ✓ (matches .env.example)
  • FETCH_HEADERS_TIMEOUT: 600 → 600000 ✓ (matches .env.example)
  • FETCH_BODY_TIMEOUT: 600 → 600000 ✓ (matches .env.example)

Comment Quality: The added comment accurately documents the millisecond unit requirement and cross-references related files. This is good practice for configuration files.

Review Coverage

  • Logic and correctness - Clean
  • Security (OWASP Top 10) - Clean
  • Error handling - N/A (config change)
  • Type safety - N/A (config change)
  • Documentation accuracy - Clean
  • Test coverage - N/A (config change)
  • Code clarity - Good

Automated review by Claude AI

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

Labels

area:deployment bug Something isn't working size/XS Extra Small PR (< 50 lines)

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant