anz-bank / pkg

Common ANZ Go packages
https://pkg.go.dev/github.com/anz-bank/pkg
Apache License 2.0
1 stars 9 forks source link

Add health.SetReadyProvider function #66

Closed juliaogris closed 4 years ago

juliaogris commented 4 years ago

Add health.SetReadyProvider function to operate on defaultState, to be served by DefaultServer. Initially we intended to simply set the ReadyProvider if desired as

health.DefaultServer.State.ReadyProvider = r

However, if the DefaultServer isn't already instantiated via

health.RegisterWithHTTP|GRPC

this can lead to unwanted race conditions and nilpointer exceptions. Instead health.SetReadyProvider operates on the private globally initialised defaultState.