Skip to content

Commit

Permalink
Change failure threshold int32 -> int
Browse files Browse the repository at this point in the history
Signed-off-by: joshvanl <me@joshvanl.dev>
  • Loading branch information
JoshVanL committed Nov 17, 2023
1 parent 1c49bca commit d10a483
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions pkg/actors/health/health.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (

const (
defaultInitialDelay = time.Second * 1
defaultFailureThreshold = int32(2)
defaultFailureThreshold = 2
defaultRequestTimeout = time.Second * 2
defaultHealthyStateInterval = time.Second * 3
defaultUnHealthyStateInterval = time.Second / 2
Expand All @@ -41,7 +41,7 @@ type options struct {
address string
initialDelay time.Duration
requestTimeout time.Duration
failureThreshold int32
failureThreshold int
healthyStateInterval time.Duration
unhealthyStateInterval time.Duration
successStatusCode int
Expand All @@ -61,7 +61,7 @@ type Checker struct {
address string
initialDelay time.Duration
requestTimeout time.Duration
failureThreshold int32
failureThreshold int
healthyStateInterval time.Duration
unhealthyStateInterval time.Duration
successStatusCode int
Expand Down Expand Up @@ -192,7 +192,7 @@ func (c *Checker) doHealthyStateCheck(ctx context.Context) {
ticker := c.clock.NewTicker(c.healthyStateInterval)
defer ticker.Stop()

var failureCount int32
var failureCount int
for {
select {
case <-ctx.Done():
Expand Down Expand Up @@ -256,7 +256,7 @@ func WithInitialDelay(delay time.Duration) Option {
}

// WithFailureThreshold sets the failure threshold for the health check.
func WithFailureThreshold(threshold int32) Option {
func WithFailureThreshold(threshold int) Option {
return func(o *options) {
o.failureThreshold = threshold
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/actors/health/health_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func TestApplyOptions(t *testing.T) {
)
require.NoError(t, err)

assert.Equal(t, defaultFailureThreshold, int32(2))
assert.Equal(t, defaultFailureThreshold, 2)
assert.Equal(t, defaultInitialDelay, time.Second)
assert.Equal(t, defaultHealthyStateInterval, time.Second*3)
assert.Equal(t, defaultUnHealthyStateInterval, time.Second/2)
Expand Down Expand Up @@ -68,7 +68,7 @@ func TestApplyOptions(t *testing.T) {
require.NoError(t, err)

assert.Equal(t, "http://localhost:8081", checker.address)
assert.Equal(t, int32(10), checker.failureThreshold)
assert.Equal(t, 10, checker.failureThreshold)
assert.Equal(t, time.Second*11, checker.initialDelay)
assert.Equal(t, time.Second*12, checker.healthyStateInterval)
assert.Equal(t, time.Second*15, checker.unhealthyStateInterval)
Expand Down

0 comments on commit d10a483

Please sign in to comment.