diff --git a/protocol/app/app.go b/protocol/app/app.go index dfb53b844ad..b05d668f247 100644 --- a/protocol/app/app.go +++ b/protocol/app/app.go @@ -612,7 +612,7 @@ func New( go func() { app.MonitorDaemon( app.LiquidationsClient, - time.Duration(daemonFlags.Shared.MaximumDaemonUnhealthySeconds)*time.Second, + time.Duration(daemonFlags.Shared.MaxDaemonUnhealthySeconds)*time.Second, ) if err := app.LiquidationsClient.Start( // The client will use `context.Background` so that it can have a different context from @@ -647,7 +647,7 @@ func New( ) app.MonitorDaemon( app.PriceFeedClient, - time.Duration(daemonFlags.Shared.MaximumDaemonUnhealthySeconds)*time.Second, + time.Duration(daemonFlags.Shared.MaxDaemonUnhealthySeconds)*time.Second, ) } @@ -658,7 +658,7 @@ func New( go func() { app.MonitorDaemon( app.BridgeClient, - time.Duration(daemonFlags.Shared.MaximumDaemonUnhealthySeconds)*time.Second, + time.Duration(daemonFlags.Shared.MaxDaemonUnhealthySeconds)*time.Second, ) if err := app.BridgeClient.Start( // The client will use `context.Background` so that it can have a different context from diff --git a/protocol/daemons/flags/flags.go b/protocol/daemons/flags/flags.go index 9f1a58df693..731461fac72 100644 --- a/protocol/daemons/flags/flags.go +++ b/protocol/daemons/flags/flags.go @@ -9,9 +9,9 @@ import ( // List of CLI flags for Server and Client. const ( // Flag names - FlagUnixSocketAddress = "unix-socket-address" - FlagPanicOnDaemonFailureEnabled = "panic-on-daemon-failure-enabled" - FlagMaximumDaemonUnhealthySeconds = "maximum-daemon-unhealthy-seconds" + FlagUnixSocketAddress = "unix-socket-address" + FlagPanicOnDaemonFailureEnabled = "panic-on-daemon-failure-enabled" + FlagMaxDaemonUnhealthySeconds = "max-daemon-unhealthy-seconds" FlagPriceDaemonEnabled = "price-daemon-enabled" FlagPriceDaemonLoopDelayMs = "price-daemon-loop-delay-ms" @@ -32,8 +32,8 @@ type SharedFlags struct { SocketAddress string // PanicOnDaemonFailureEnabled toggles whether the daemon should panic on failure. PanicOnDaemonFailureEnabled bool - // MaximumDaemonUnhealthySeconds is the maximum allowable duration for which a daemon can be unhealthy. - MaximumDaemonUnhealthySeconds uint32 + // MaxDaemonUnhealthySeconds is the maximum allowable duration for which a daemon can be unhealthy. + MaxDaemonUnhealthySeconds uint32 } // BridgeFlags contains configuration flags for the Bridge Daemon. @@ -80,9 +80,9 @@ func GetDefaultDaemonFlags() DaemonFlags { if defaultDaemonFlags == nil { defaultDaemonFlags = &DaemonFlags{ Shared: SharedFlags{ - SocketAddress: "/tmp/daemons.sock", - PanicOnDaemonFailureEnabled: true, - MaximumDaemonUnhealthySeconds: 5 * 60, + SocketAddress: "/tmp/daemons.sock", + PanicOnDaemonFailureEnabled: true, + MaxDaemonUnhealthySeconds: 5 * 60, }, Bridge: BridgeFlags{ Enabled: true, @@ -126,8 +126,8 @@ func AddDaemonFlagsToCmd( "Enables panicking when a daemon fails.", ) cmd.Flags().Uint32( - FlagMaximumDaemonUnhealthySeconds, - df.Shared.MaximumDaemonUnhealthySeconds, + FlagMaxDaemonUnhealthySeconds, + df.Shared.MaxDaemonUnhealthySeconds, "Maximum allowable duration for which a daemon can be unhealthy.", ) @@ -201,9 +201,9 @@ func GetDaemonFlagValuesFromOptions( result.Shared.PanicOnDaemonFailureEnabled = v } } - if option := appOpts.Get(FlagMaximumDaemonUnhealthySeconds); option != nil { + if option := appOpts.Get(FlagMaxDaemonUnhealthySeconds); option != nil { if v, err := cast.ToUint32E(option); err == nil { - result.Shared.MaximumDaemonUnhealthySeconds = v + result.Shared.MaxDaemonUnhealthySeconds = v } } diff --git a/protocol/daemons/flags/flags_test.go b/protocol/daemons/flags/flags_test.go index cb0e8a08d2a..04191032f60 100644 --- a/protocol/daemons/flags/flags_test.go +++ b/protocol/daemons/flags/flags_test.go @@ -18,7 +18,7 @@ func TestAddDaemonFlagsToCmd(t *testing.T) { tests := []string{ flags.FlagUnixSocketAddress, flags.FlagPanicOnDaemonFailureEnabled, - flags.FlagMaximumDaemonUnhealthySeconds, + flags.FlagMaxDaemonUnhealthySeconds, flags.FlagBridgeDaemonEnabled, flags.FlagBridgeDaemonLoopDelayMs, @@ -44,7 +44,7 @@ func TestGetDaemonFlagValuesFromOptions_Custom(t *testing.T) { optsMap[flags.FlagUnixSocketAddress] = "test-socket-address" optsMap[flags.FlagPanicOnDaemonFailureEnabled] = false - optsMap[flags.FlagMaximumDaemonUnhealthySeconds] = uint32(1234) + optsMap[flags.FlagMaxDaemonUnhealthySeconds] = uint32(1234) optsMap[flags.FlagBridgeDaemonEnabled] = true optsMap[flags.FlagBridgeDaemonLoopDelayMs] = uint32(1111) @@ -71,8 +71,8 @@ func TestGetDaemonFlagValuesFromOptions_Custom(t *testing.T) { require.Equal(t, optsMap[flags.FlagPanicOnDaemonFailureEnabled], r.Shared.PanicOnDaemonFailureEnabled) require.Equal( t, - optsMap[flags.FlagMaximumDaemonUnhealthySeconds], - r.Shared.MaximumDaemonUnhealthySeconds, + optsMap[flags.FlagMaxDaemonUnhealthySeconds], + r.Shared.MaxDaemonUnhealthySeconds, ) // Bridge Daemon. diff --git a/protocol/daemons/pricefeed/client/client_integration_test.go b/protocol/daemons/pricefeed/client/client_integration_test.go index 08a4708667d..45d32a28a45 100644 --- a/protocol/daemons/pricefeed/client/client_integration_test.go +++ b/protocol/daemons/pricefeed/client/client_integration_test.go @@ -339,7 +339,7 @@ func (s *PriceDaemonIntegrationTestSuite) startClient() { ) err := s.healthMonitor.RegisterService( s.pricefeedDaemon, - time.Duration(s.daemonFlags.Shared.MaximumDaemonUnhealthySeconds)*time.Second, + time.Duration(s.daemonFlags.Shared.MaxDaemonUnhealthySeconds)*time.Second, ) s.Require().NoError(err) }