Skip to content

Commit 3e28441

Browse files
committed
fix: bound sync attempt to single 15m timeout (clone + build)
- 이전: cloneCtx, buildCtx 각각 10분 독립 timeout (시도당 최대 20분) - 이후: attemptCtx 하나로 clone + build 묶음 (시도당 최대 15분) - 3회 retry 기준 총 최대 소요 시간: ~46분 (이전 대비 ~30분 단축) - guide/webhook.md retry 섹션 총 소요시간 명시 및 AttemptTimeout 오기재 수정
1 parent 997cac9 commit 3e28441

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

cmd/ccg/main.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,9 +280,11 @@ func serveStreamableHTTP(deps *cli.Deps, srv *server.MCPServer, cfg cli.ServeCon
280280
syncHandler := func(ctx context.Context, repoFullName, cloneURL string) error {
281281
ns := webhook.ExtractNamespace(repoFullName)
282282
deps.Logger.Info("webhook sync started", "repo", repoFullName, "namespace", ns)
283-
cloneCtx, cloneCancel := context.WithTimeout(ctx, 10*time.Minute)
284-
defer cloneCancel()
285-
if err := webhook.CloneOrPull(cloneCtx, cloneURL, cfg.RepoRoot, ns, nil); err != nil {
283+
284+
attemptCtx, attemptCancel := context.WithTimeout(ctx, 15*time.Minute)
285+
defer attemptCancel()
286+
287+
if err := webhook.CloneOrPull(attemptCtx, cloneURL, cfg.RepoRoot, ns, nil); err != nil {
286288
deps.Logger.Error("webhook clone/pull failed", "repo", repoFullName, "error", err)
287289
return err
288290
}
@@ -295,9 +297,7 @@ func serveStreamableHTTP(deps *cli.Deps, srv *server.MCPServer, cfg cli.ServeCon
295297
Walkers: deps.Walkers,
296298
Logger: deps.Logger,
297299
}
298-
buildCtx, buildCancel := context.WithTimeout(ctx, 10*time.Minute)
299-
defer buildCancel()
300-
buildCtx = ctxns.WithNamespace(buildCtx, ns)
300+
buildCtx := ctxns.WithNamespace(attemptCtx, ns)
301301
stats, err := graphSvc.Build(buildCtx, service.BuildOptions{
302302
Dir: repoDir,
303303
IncludePaths: pathutil.LoadIncludePathsFromConfig(repoDir),

guide/webhook.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ Push Event → HMAC Verify → RepoFilter.IsAllowedRef()
109109
| BaseDelay | 1s | 첫 번째 재시도 대기 시간 |
110110
| MaxDelay | 30s | 재시도 대기 시간 상한 |
111111

112+
- **시도당 timeout**: clone과 build가 하나의 15분 context를 공유 — 합산 초과 시 해당 시도 실패 후 retry
113+
- **총 최대 소요 시간**: 3회 × 15분 + backoff(최대 ~30초) ≈ **46분**
112114
- 지수 증가: 1s → 2s → 4s → ... (MaxDelay 초과 시 MaxDelay로 고정)
113115
- context 취소(서버 종료) 시 대기 중인 retry 즉시 중단
114116
- panic도 에러로 처리되어 retry 대상이 됨

0 commit comments

Comments
 (0)