diff --git a/protocol/app/app.go b/protocol/app/app.go index b616994e805..ae174ef6f6a 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.MaximumAllowableDaemonUnhealthySeconds)*time.Second, + time.Duration(daemonFlags.Shared.MaximumDaemonUnhealthySeconds)*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.MaximumAllowableDaemonUnhealthySeconds)*time.Second, + time.Duration(daemonFlags.Shared.MaximumDaemonUnhealthySeconds)*time.Second, ) } @@ -660,7 +660,7 @@ func New( go func() { app.MonitorDaemon( app.BridgeClient, - time.Duration(daemonFlags.Shared.MaximumAllowableDaemonUnhealthySeconds)*time.Second, + time.Duration(daemonFlags.Shared.MaximumDaemonUnhealthySeconds)*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 656b77778ed..fc880740353 100644 --- a/protocol/daemons/flags/flags.go +++ b/protocol/daemons/flags/flags.go @@ -23,8 +23,8 @@ const ( FlagLiquidationDaemonSubaccountPageLimit = "liquidation-daemon-subaccount-page-limit" FlagLiquidationDaemonRequestChunkSize = "liquidation-daemon-request-chunk-size" - FlagDisablePanicOnDaemonFailure = "disable-panic-on-daemon-failure" - FlagMaximumAllowableDaemonUnhealthySeconds = "maximum-allowable-daemon-unhealthy-duration" + FlagDisablePanicOnDaemonFailure = "disable-panic-on-daemon-failure" + FlagMaximumDaemonUnhealthySeconds = "maximum-daemon-unhealthy-seconds" ) // Shared flags contains configuration flags shared by all daemons. @@ -33,8 +33,8 @@ type SharedFlags struct { SocketAddress string // DisablePanicOnDaemonFailure toggles whether the daemon should panic on failure. DisablePanicOnDaemonFailure bool - // MaximumAllowableDaemonUnhealthySeconds is the maximum allowable duration for which a daemon can be unhealthy. - MaximumAllowableDaemonUnhealthySeconds uint32 + // MaximumDaemonUnhealthySeconds is the maximum allowable duration for which a daemon can be unhealthy. + MaximumDaemonUnhealthySeconds uint32 } // BridgeFlags contains configuration flags for the Bridge Daemon. @@ -81,9 +81,9 @@ func GetDefaultDaemonFlags() DaemonFlags { if defaultDaemonFlags == nil { defaultDaemonFlags = &DaemonFlags{ Shared: SharedFlags{ - SocketAddress: "/tmp/daemons.sock", - DisablePanicOnDaemonFailure: false, - MaximumAllowableDaemonUnhealthySeconds: 5 * 60, + SocketAddress: "/tmp/daemons.sock", + DisablePanicOnDaemonFailure: false, + MaximumDaemonUnhealthySeconds: 5 * 60, }, Bridge: BridgeFlags{ Enabled: true, @@ -127,8 +127,8 @@ func AddDaemonFlagsToCmd( "Disables the default behavior of panicking when a daemon fails.", ) cmd.Flags().Uint32( - FlagMaximumAllowableDaemonUnhealthySeconds, - df.Shared.MaximumAllowableDaemonUnhealthySeconds, + FlagMaximumDaemonUnhealthySeconds, + df.Shared.MaximumDaemonUnhealthySeconds, "Sets the maximum allowable duration, in seconds, that a daemon can be unhealthy before the app panics.", ) @@ -202,9 +202,9 @@ func GetDaemonFlagValuesFromOptions( result.Shared.DisablePanicOnDaemonFailure = v } } - if option := appOpts.Get(FlagMaximumAllowableDaemonUnhealthySeconds); option != nil { + if option := appOpts.Get(FlagMaximumDaemonUnhealthySeconds); option != nil { if v, err := cast.ToUint32E(option); err == nil { - result.Shared.MaximumAllowableDaemonUnhealthySeconds = v + result.Shared.MaximumDaemonUnhealthySeconds = v } } diff --git a/protocol/daemons/flags/flags_test.go b/protocol/daemons/flags/flags_test.go index a3c6c80caa7..849efbf5e1f 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.FlagDisablePanicOnDaemonFailure, - flags.FlagMaximumAllowableDaemonUnhealthySeconds, + flags.FlagMaximumDaemonUnhealthySeconds, flags.FlagBridgeDaemonEnabled, flags.FlagBridgeDaemonLoopDelayMs, @@ -44,7 +44,7 @@ func TestGetDaemonFlagValuesFromOptions_Custom(t *testing.T) { optsMap[flags.FlagUnixSocketAddress] = "test-socket-address" optsMap[flags.FlagDisablePanicOnDaemonFailure] = true - optsMap[flags.FlagMaximumAllowableDaemonUnhealthySeconds] = uint32(1234) + optsMap[flags.FlagMaximumDaemonUnhealthySeconds] = 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.FlagDisablePanicOnDaemonFailure], r.Shared.DisablePanicOnDaemonFailure) require.Equal( t, - optsMap[flags.FlagMaximumAllowableDaemonUnhealthySeconds], - r.Shared.MaximumAllowableDaemonUnhealthySeconds, + optsMap[flags.FlagMaximumDaemonUnhealthySeconds], + r.Shared.MaximumDaemonUnhealthySeconds, ) // Bridge Daemon. diff --git a/protocol/daemons/pricefeed/client/client_integration_test.go b/protocol/daemons/pricefeed/client/client_integration_test.go index 9ea60db98b1..46f61f7c89d 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(flags.GetDefaultDaemonFlags().Shared.MaximumAllowableDaemonUnhealthySeconds)*time.Second, + time.Duration(flags.GetDefaultDaemonFlags().Shared.MaximumDaemonUnhealthySeconds)*time.Second, ) s.Require().NoError(err) }