Skip to content

Commit

Permalink
Merge pull request #330 from mreiferson/github-actions-fix
Browse files Browse the repository at this point in the history
*: fix github actions
  • Loading branch information
mreiferson authored Sep 12, 2021
2 parents 372c9e4 + 2f8d0cc commit 3bce8d0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ jobs:

- name: download NSQ
run: |
cd ${{env.SRCDIR}}
curl -sSL "http://bitly-downloads.s3.amazonaws.com/nsq/${{matrix.nsq_ver}}.tar.gz" \
| tar -xzv --strip-components=1
- name: test
run: |
cd ${{env.SRCDIR}}
export PATH=bin:$PATH
./test.sh
2 changes: 1 addition & 1 deletion config.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (s *FullJitterStrategy) Calculate(attempt int) time.Duration {

backoffDuration := s.cfg.BackoffMultiplier *
time.Duration(math.Pow(2, float64(attempt)))
return time.Duration(s.rng.Intn(int(backoffDuration)))
return time.Duration(s.rng.Int63n(int64(backoffDuration)))
}

func (s *FullJitterStrategy) setConfig(cfg *Config) {
Expand Down
4 changes: 2 additions & 2 deletions config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ func TestExponentialBackoff(t *testing.T) {

func TestFullJitterBackoff(t *testing.T) {
expected := []time.Duration{
566028617 * time.Nanosecond,
1365407263 * time.Nanosecond,
724039541 * time.Nanosecond,
1603903257 * time.Nanosecond,
5232470547 * time.Nanosecond,
21467499218 * time.Nanosecond,
}
Expand Down

0 comments on commit 3bce8d0

Please sign in to comment.