Skip to content

Commit

Permalink
more linting
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkruger committed Dec 16, 2024
1 parent 3b58eda commit e68f87d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 6 additions & 1 deletion internal/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ import (
"github.com/launchdarkly/ld-find-code-refs/v2/internal/log"
)

const (
// ... other constants ...
millisecondsInSecond = 1000 // Descriptive constant for milliseconds conversion
)

type Client struct {
workspace string
GitBranch string
Expand Down Expand Up @@ -327,7 +332,7 @@ func makeExtinctionRepFromCommit(projectKey, flagKey string, commit *object.Comm
return ld.ExtinctionRep{
Revision: commit.Hash.String(),
Message: commit.Message,
Time: commit.Author.When.Unix() * 1000,
Time: commit.Author.When.Unix() * millisecondsInSecond,
ProjKey: projectKey,
FlagKey: flagKey,
}
Expand Down
6 changes: 3 additions & 3 deletions internal/ld/ld.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ func IsTransient(err error) bool {
// Fallback to default backoff if header can't be parsed
// https://apidocs.launchdarkly.com/#section/Overview/Rate-limiting
// Method is curried in order to avoid stubbing the time package and fallback Backoff in unit tests
func RateLimitBackoff(now func() time.Time, fallbackBackoff h.Backoff) func(minDuration, max time.Duration, attemptNum int, resp *http.Response) time.Duration {
return func(minDuration, max time.Duration, attemptNum int, resp *http.Response) time.Duration {
func RateLimitBackoff(now func() time.Time, fallbackBackoff h.Backoff) func(minDuration, maxDuration time.Duration, attemptNum int, resp *http.Response) time.Duration {
return func(minDuration, maxDuration time.Duration, attemptNum int, resp *http.Response) time.Duration {
if resp != nil {
if resp.StatusCode == http.StatusTooManyRequests {
if s, ok := resp.Header["X-Ratelimit-Reset"]; ok {
Expand All @@ -96,7 +96,7 @@ func RateLimitBackoff(now func() time.Time, fallbackBackoff h.Backoff) func(minD
}
}

return fallbackBackoff(minDuration, max, attemptNum, resp)
return fallbackBackoff(minDuration, maxDuration, attemptNum, resp)
}
}

Expand Down

0 comments on commit e68f87d

Please sign in to comment.