Skip to content

Commit

Permalink
Use MustNewDuration
Browse files Browse the repository at this point in the history
  • Loading branch information
DylanTinianov committed Jan 4, 2024
1 parent 49c1fb2 commit 5054c05
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions core/services/chainlink/config_auto_pprof.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ func (a *autoPprofConfig) CPUProfileRate() int {
}

func (a *autoPprofConfig) GatherDuration() commonconfig.Duration {
return commonconfig.MustMakeDuration(a.c.GatherDuration.Duration())
return *commonconfig.MustNewDuration(a.c.GatherDuration.Duration())
}

func (a *autoPprofConfig) GatherTraceDuration() commonconfig.Duration {
return commonconfig.MustMakeDuration(a.c.GatherTraceDuration.Duration())
return *commonconfig.MustNewDuration(a.c.GatherTraceDuration.Duration())
}

func (a *autoPprofConfig) GoroutineThreshold() int {
Expand Down
4 changes: 2 additions & 2 deletions core/services/chainlink/config_general.go
Original file line number Diff line number Diff line change
Expand Up @@ -358,11 +358,11 @@ func (g *generalConfig) AutoPprofCPUProfileRate() int {
}

func (g *generalConfig) AutoPprofGatherDuration() commonconfig.Duration {
return commonconfig.MustMakeDuration(g.c.AutoPprof.GatherDuration.Duration())
return *commonconfig.MustNewDuration(g.c.AutoPprof.GatherDuration.Duration())
}

func (g *generalConfig) AutoPprofGatherTraceDuration() commonconfig.Duration {
return commonconfig.MustMakeDuration(g.c.AutoPprof.GatherTraceDuration.Duration())
return *commonconfig.MustNewDuration(g.c.AutoPprof.GatherTraceDuration.Duration())
}

func (g *generalConfig) AutoPprofGoroutineThreshold() int {
Expand Down
2 changes: 1 addition & 1 deletion core/services/chainlink/config_web_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ func (w *webServerConfig) SessionOptions() sessions.Options {
}

func (w *webServerConfig) SessionTimeout() commonconfig.Duration {
return commonconfig.MustMakeDuration(w.c.SessionTimeout.Duration())
return *commonconfig.MustNewDuration(w.c.SessionTimeout.Duration())
}

func (w *webServerConfig) ListenIP() net.IP {
Expand Down
6 changes: 3 additions & 3 deletions core/services/feeds/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ func Test_Service_ProposeJob(t *testing.T) {
JobProposalID: idBootstrap,
}

httpTimeout = commonconfig.MustMakeDuration(1 * time.Second)
httpTimeout = *commonconfig.MustNewDuration(1 * time.Second)
)

testCases := []struct {
Expand Down Expand Up @@ -806,7 +806,7 @@ func Test_Service_DeleteJob(t *testing.T) {
Status: feeds.JobProposalStatusApproved,
}

httpTimeout = commonconfig.MustMakeDuration(1 * time.Second)
httpTimeout = *commonconfig.MustNewDuration(1 * time.Second)
)

testCases := []struct {
Expand Down Expand Up @@ -946,7 +946,7 @@ answer1 [type=median index=0];
Definition: defn,
}

httpTimeout = commonconfig.MustMakeDuration(1 * time.Second)
httpTimeout = *commonconfig.MustNewDuration(1 * time.Second)
)

testCases := []struct {
Expand Down
2 changes: 1 addition & 1 deletion core/services/fluxmonitorv2/validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
type testcfg struct{}

func (testcfg) DefaultHTTPTimeout() commonconfig.Duration {
return commonconfig.MustMakeDuration(2 * time.Second)
return *commonconfig.MustNewDuration(2 * time.Second)
}

func TestValidate(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions core/sessions/ldapauth/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ func (t *TestConfig) ServerTLS() bool {
}

func (t *TestConfig) SessionTimeout() commonconfig.Duration {
return commonconfig.MustMakeDuration(time.Duration(0))
return *commonconfig.MustNewDuration(time.Duration(0))
}

func (t *TestConfig) QueryTimeout() time.Duration {
return time.Duration(0)
}

func (t *TestConfig) UserAPITokenDuration() commonconfig.Duration {
return commonconfig.MustMakeDuration(time.Duration(0))
return *commonconfig.MustNewDuration(time.Duration(0))
}

func (t *TestConfig) BaseUserAttr() string {
Expand Down Expand Up @@ -123,9 +123,9 @@ func (t *TestConfig) UserApiTokenEnabled() bool {
}

func (t *TestConfig) UpstreamSyncInterval() commonconfig.Duration {
return commonconfig.MustMakeDuration(time.Duration(0))
return *commonconfig.MustNewDuration(time.Duration(0))
}

func (t *TestConfig) UpstreamSyncRateLimit() commonconfig.Duration {
return commonconfig.MustMakeDuration(time.Duration(0))
return *commonconfig.MustNewDuration(time.Duration(0))
}
4 changes: 2 additions & 2 deletions core/sessions/localauth/reaper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ import (
type sessionReaperConfig struct{}

func (c sessionReaperConfig) SessionTimeout() commonconfig.Duration {
return commonconfig.MustMakeDuration(42 * time.Second)
return *commonconfig.MustNewDuration(42 * time.Second)
}

func (c sessionReaperConfig) SessionReaperExpiration() commonconfig.Duration {
return commonconfig.MustMakeDuration(142 * time.Second)
return *commonconfig.MustNewDuration(142 * time.Second)
}

func TestSessionReaper_ReapSessions(t *testing.T) {
Expand Down
8 changes: 4 additions & 4 deletions core/web/presenters/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,15 +296,15 @@ func NewVRFSpec(spec *job.VRFSpec) *VRFSpec {
CoordinatorAddress: spec.CoordinatorAddress,
PublicKey: spec.PublicKey,
FromAddresses: spec.FromAddresses,
PollPeriod: commonconfig.MustMakeDuration(spec.PollPeriod),
PollPeriod: *commonconfig.MustNewDuration(spec.PollPeriod),
MinIncomingConfirmations: spec.MinIncomingConfirmations,
CreatedAt: spec.CreatedAt,
UpdatedAt: spec.UpdatedAt,
EVMChainID: spec.EVMChainID,
ChunkSize: spec.ChunkSize,
RequestTimeout: commonconfig.MustMakeDuration(spec.RequestTimeout),
BackoffInitialDelay: commonconfig.MustMakeDuration(spec.BackoffInitialDelay),
BackoffMaxDelay: commonconfig.MustMakeDuration(spec.BackoffMaxDelay),
RequestTimeout: *commonconfig.MustNewDuration(spec.RequestTimeout),
BackoffInitialDelay: *commonconfig.MustNewDuration(spec.BackoffInitialDelay),
BackoffMaxDelay: *commonconfig.MustNewDuration(spec.BackoffMaxDelay),
GasLanePrice: spec.GasLanePrice,
RequestedConfsDelay: spec.RequestedConfsDelay,
VRFOwnerAddress: spec.VRFOwnerAddress,
Expand Down

0 comments on commit 5054c05

Please sign in to comment.