Skip to content

Commit 294a764

Browse files
authored
Merge pull request #51 from utilitywarehouse/as-small-updates
adjust time-out duration for rate limit
2 parents 856fb89 + 66b31c0 commit 294a764

File tree

3 files changed

+2
-5
lines changed

3 files changed

+2
-5
lines changed

config.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
const (
2020
defaultGitGC = "always"
2121
defaultInterval = time.Minute
22-
defaultMirrorTimeout = 2 * time.Minute
22+
defaultMirrorTimeout = 4 * time.Minute // git operations can be delayed by server when rate limited
2323
defaultSSHKeyPath = "/etc/git-secret/ssh"
2424
defaultSSHKnownHostsPath = "/etc/git-secret/known_hosts"
2525
)

pkg/mirror/helper.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func runGitCommand(ctx context.Context, log *slog.Logger, envs []string, cwd str
200200
log.Log(ctx, -8, "running command", "cwd", cwd, "cmd", cmdStr)
201201

202202
cmd := exec.CommandContext(ctx, gitExecutablePath, args...)
203-
// force kill git 5 seconds after sending it sigterm
203+
// force kill git & child process 5 seconds after sending it sigterm (when ctx is cancelled/timed out)
204204
cmd.WaitDelay = 5 * time.Second
205205
if cwd != "" {
206206
cmd.Dir = cwd

pkg/mirror/repository.go

-3
Original file line numberDiff line numberDiff line change
@@ -398,9 +398,6 @@ func (r *Repository) StartLoop(ctx context.Context) {
398398
mCtx, cancel := context.WithTimeout(ctx, r.mirrorTimeout)
399399
err := r.Mirror(mCtx)
400400
cancel()
401-
if err != nil {
402-
r.log.Error("repository mirror failed", "err", err)
403-
}
404401
recordGitMirror(r.gitURL.Repo, err == nil)
405402

406403
t := time.NewTimer(jitter(r.interval, 0.2))

0 commit comments

Comments
 (0)