From 5054c05e3343db185268999df39b2106f6d70db0 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Thu, 4 Jan 2024 13:36:24 -0500 Subject: [PATCH] Use MustNewDuration --- core/services/chainlink/config_auto_pprof.go | 4 ++-- core/services/chainlink/config_general.go | 4 ++-- core/services/chainlink/config_web_server.go | 2 +- core/services/feeds/service_test.go | 6 +++--- core/services/fluxmonitorv2/validate_test.go | 2 +- core/sessions/ldapauth/helpers_test.go | 8 ++++---- core/sessions/localauth/reaper_test.go | 4 ++-- core/web/presenters/job.go | 8 ++++---- 8 files changed, 19 insertions(+), 19 deletions(-) diff --git a/core/services/chainlink/config_auto_pprof.go b/core/services/chainlink/config_auto_pprof.go index b9900f82b8f..48ec7749b79 100644 --- a/core/services/chainlink/config_auto_pprof.go +++ b/core/services/chainlink/config_auto_pprof.go @@ -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 { diff --git a/core/services/chainlink/config_general.go b/core/services/chainlink/config_general.go index afeab35aecc..97243926973 100644 --- a/core/services/chainlink/config_general.go +++ b/core/services/chainlink/config_general.go @@ -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 { diff --git a/core/services/chainlink/config_web_server.go b/core/services/chainlink/config_web_server.go index 3e13846349f..473f70a4c9c 100644 --- a/core/services/chainlink/config_web_server.go +++ b/core/services/chainlink/config_web_server.go @@ -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 { diff --git a/core/services/feeds/service_test.go b/core/services/feeds/service_test.go index dbd4fc2548d..d822cd9787d 100644 --- a/core/services/feeds/service_test.go +++ b/core/services/feeds/service_test.go @@ -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 { @@ -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 { @@ -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 { diff --git a/core/services/fluxmonitorv2/validate_test.go b/core/services/fluxmonitorv2/validate_test.go index cd971a54469..40efd1d724d 100644 --- a/core/services/fluxmonitorv2/validate_test.go +++ b/core/services/fluxmonitorv2/validate_test.go @@ -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) { diff --git a/core/sessions/ldapauth/helpers_test.go b/core/sessions/ldapauth/helpers_test.go index d3c207e5bf0..5c19afd17d3 100644 --- a/core/sessions/ldapauth/helpers_test.go +++ b/core/sessions/ldapauth/helpers_test.go @@ -67,7 +67,7 @@ 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 { @@ -75,7 +75,7 @@ func (t *TestConfig) QueryTimeout() time.Duration { } func (t *TestConfig) UserAPITokenDuration() commonconfig.Duration { - return commonconfig.MustMakeDuration(time.Duration(0)) + return *commonconfig.MustNewDuration(time.Duration(0)) } func (t *TestConfig) BaseUserAttr() string { @@ -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)) } diff --git a/core/sessions/localauth/reaper_test.go b/core/sessions/localauth/reaper_test.go index 867c2182bb7..224ae1a8cb3 100644 --- a/core/sessions/localauth/reaper_test.go +++ b/core/sessions/localauth/reaper_test.go @@ -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) { diff --git a/core/web/presenters/job.go b/core/web/presenters/job.go index f7798629b18..a7aed0e5552 100644 --- a/core/web/presenters/job.go +++ b/core/web/presenters/job.go @@ -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,