types

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DaemonStartupGracePeriod is the amount of time to wait for before a daemon is expected to start querying
	// the daemon server. This is used to ensure that spurious panics aren't produced due to the daemons waiting for
	// the cosmos grpc service to start. If cli tests are failing due to panics because it is taking the network
	// a long time to start the protocol, it's possible this value could be increased.
	DaemonStartupGracePeriod = 60 * time.Second

	// MaximumLoopDelayMultiple defines the maximum acceptable update delay for a daemon as a multiple of the
	// daemon's loop delay. This is set to 8 to have generous headroom to ignore errors from the liquidations daemon,
	// which we have sometimes seen to take up to ~10s to respond.
	MaximumLoopDelayMultiple = 8

	LiquidationsDaemonServiceName = "liquidations-daemon"
	PricefeedDaemonServiceName    = "pricefeed-daemon"
	BridgeDaemonServiceName       = "bridge-daemon"
	MetricsDaemonServiceName      = "metrics-daemon"
)

Variables

This section is empty.

Functions

func LogErrorServiceNotResponding added in v0.4.0

func LogErrorServiceNotResponding(service string, logger log.Logger) func()

LogErrorServiceNotResponding returns a function that logs an error indicating that the specified daemon service is not responding. This is ideal for creating a callback function when registering a daemon service.

func MaximumAcceptableUpdateDelay

func MaximumAcceptableUpdateDelay(loopDelayMs uint32) time.Duration

MaximumAcceptableUpdateDelay computes the maximum acceptable update delay for a daemon service as a multiple of the loop delay.

func PanicServiceNotResponding

func PanicServiceNotResponding(service string) func()

PanicServiceNotResponding returns a function that panics with a message indicating that the specified daemon service is not responding. This is ideal for creating a callback function when registering a daemon service.

Types

type UpdateMonitor

type UpdateMonitor struct {
	// contains filtered or unexported fields
}

UpdateMonitor monitors the update frequency of daemon services. If a daemon service does not respond within the maximum acceptable update delay set when the daemon is registered, the monitor will log an error and halt the protocol. This was judged to be the best solution for network performance because it prevents any validator from participating in the network at all if a daemon service is not responding.

func NewUpdateFrequencyMonitor

func NewUpdateFrequencyMonitor(daemonStartupGracePeriod time.Duration, logger log.Logger) *UpdateMonitor

NewUpdateFrequencyMonitor creates a new update frequency monitor.

func (*UpdateMonitor) DisableForTesting

func (ufm *UpdateMonitor) DisableForTesting()

func (*UpdateMonitor) RegisterDaemonService

func (ufm *UpdateMonitor) RegisterDaemonService(
	service string,
	maximumAcceptableUpdateDelay time.Duration,
) error

RegisterDaemonService registers a new daemon service with the update frequency monitor. If the daemon service fails to respond within the maximum acceptable update delay, the monitor will log an error. This method is synchronized. The method an error if the daemon service was already registered or the monitor has already been stopped.

func (*UpdateMonitor) RegisterDaemonServiceWithCallback

func (ufm *UpdateMonitor) RegisterDaemonServiceWithCallback(
	service string,
	maximumAcceptableUpdateDelay time.Duration,
	callback func(),
) error

RegisterDaemonServiceWithCallback registers a new daemon service with the update frequency monitor. If the daemon service fails to respond within the maximum acceptable update delay, the monitor will execute the callback function. This method is synchronized. The method returns an error if the daemon service was already registered or the monitor has already been stopped.

func (*UpdateMonitor) RegisterValidResponse

func (ufm *UpdateMonitor) RegisterValidResponse(service string) error

RegisterValidResponse registers a valid response from the daemon service. This will reset the timer for the daemon service. This method is synchronized.

func (*UpdateMonitor) Stop

func (ufm *UpdateMonitor) Stop()

Stop stops the update frequency monitor. This method is synchronized.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL