From a35338a1c7260591abbb980e75869cd66b95b429 Mon Sep 17 00:00:00 2001 From: Ivor Scott Date: Thu, 18 Jul 2024 01:26:05 +0200 Subject: [PATCH] fix: lower max attempts --- constants.go | 4 ++-- executor.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/constants.go b/constants.go index abee230..0609025 100644 --- a/constants.go +++ b/constants.go @@ -29,6 +29,6 @@ const ( // StagedCopied means a copied file staged change. StagedCopied = "C " - // MaxFetchBranchAttempts represents a maximum reties to fetch branches. - MaxFetchBranchAttempts = 30 + // MaxAttempts represents maximum reties. + MaxAttempts = 5 ) diff --git a/executor.go b/executor.go index 8ec32ec..4a3ddcd 100644 --- a/executor.go +++ b/executor.go @@ -48,7 +48,7 @@ func (g *GitExecutor) hasRemoteURL() bool { // fetchBranches fetches the branches from the remote and retries on failures. func (g *GitExecutor) fetchBranches() error { cmd := exec.Command("git", "-C", g.GitRoot, "fetch", g.RemoteName) - return execCommandWithRetry(cmd, g.GitRoot, g.RemoteName, MaxFetchBranchAttempts) + return execCommandWithRetry(cmd, g.GitRoot, g.RemoteName, MaxAttempts) } // branchExistsLocally checks if the desired branch exists locally. @@ -179,7 +179,7 @@ var cb *gobreaker.CircuitBreaker func init() { settings := gobreaker.Settings{ Name: "GitCommandCircuitBreaker", - MaxRequests: 5, + MaxRequests: MaxAttempts, Interval: time.Minute, Timeout: time.Minute, ReadyToTrip: func(counts gobreaker.Counts) bool {