【架构优化】合并 engine/cloud_pool.go 中重复的执行池候选 runner 收集与启用判断
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- Nửa ngày
- Mức phù hợp với người mới
- 30/100
Hướng nghiên cứu
The duplicated runner-listing loop sits in pickPoolRunner and CloudPoolStatus, and the duplicated enablement check sits in cloudPoolRunner and cloudPoolRequired, all in internal/engine/cloud_pool.go. Read poolRunnerEligible and cloudPoolServes first, then extract eligiblePoolRunners and the unexported serves method. Pull request #467 already targets this change, so check its state before starting. Done when both call sites share the helpers, go test ./internal/engine/ passes including TestCloudPoolSelectionStatusAndBindingErrors, and the new table-driven tests in cloud_pool_helpers_test.go pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
现状问题
internal/engine/cloud_pool.go 中有两处重复:
- 「列出当前可承接云端执行池任务的 runner」的循环(遍历
e.repo.Runners()并用poolRunnerEligible过滤)在pickPoolRunner和CloudPoolStatus各写了一遍,一个收集候选、一个计数。 - 「执行池已启用且覆盖该项目」的判断
pool.Label != "" && cloudPoolServes(pool.Projects, projectID)在cloudPoolRunner与cloudPoolRequired中各写了一遍。
以后调整资格规则或启用条件时容易只改一处。
重构方案
- 新增
(*Engine).eligiblePoolRunners(label) []domain.Runner,pickPoolRunner从中随机挑选,CloudPoolStatus返回其长度。 - 新增
(CloudRunnerPool).serves(projectID) bool(未导出),cloudPoolRunner/cloudPoolRequired改为调用它。 - 函数签名、导出 API、错误文案、选择逻辑均不变。
影响范围
仅 internal/engine/cloud_pool.go,新增测试文件 internal/engine/cloud_pool_helpers_test.go。不涉及对外接口与行为。
验证方式
gofmt/go vet ./internal/engine/- 新增表驱动测试覆盖
serves的各种组合,以及eligiblePoolRunners对标签/归属/在线状态/版本的过滤,并核对与CloudPoolStatus、pickPoolRunner结果一致 go test ./internal/engine/原有用例(含TestCloudPoolSelectionStatusAndBindingErrors)保持通过
- Ngôn ngữ chính
- Go
- Star
- 141
- Fork
- 28
- Merge trung bình
- 1 ngày 15 giờ
- Pull request đã merge (30 ngày)
- 113
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của Tencent/LoopForge
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: 官方镜像未安装 wecom-cli,企业微信通知报「通知服务未安装 wecom-cli」Có thể đã có người làm @newexploreor đã nhận 1 ngày trước. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Tencent/LoopForge#156 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
【架构优化】合并 gitwork/workbranch.go 中 push/pull 重复的默认提交身份注入为 withFallbackIdentityCó thể đã có người làm @fx-kurumi đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 40/100
Maintainer thường phản hồi trong vòng 1 ngày
-
【架构优化】从 runtime.installNPMCLI 中拆出 npm 参数拼装 npmCLIInstallArgs 与安装结果启用 activateNPMStageCó thể đã có người làm @fx-kurumi đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của Tencent/LoopForge
Issue tương tự
-
team:library-maintainers
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
padok-team/burrito#1208 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
bazel-contrib/rules_go#4784 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
Уязвимые компоненты в GoĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
POSIdev-community/aictl#40 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 62/100
prime-radiant-inc/evener#6306 ·
Maintainer thường phản hồi trong vòng 1 ngày