mirror of https://github.com/hashicorp/consul
agent: address some basic feedback
parent
19ced12668
commit
f97bfd5be8
|
@ -17,7 +17,7 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
// CheckAlias is a check type that aliases the health of another service
|
// CheckAlias is a check type that aliases the health of another service
|
||||||
// instance. If the service aliased has any critical health checks, then
|
// instance or node. If the service aliased has any critical health checks, then
|
||||||
// this check is critical. If the service has no critical but warnings,
|
// this check is critical. If the service has no critical but warnings,
|
||||||
// then this check is warning, and if a service has only passing checks, then
|
// then this check is warning, and if a service has only passing checks, then
|
||||||
// this check is passing.
|
// this check is passing.
|
||||||
|
@ -46,7 +46,7 @@ type AliasNotifier interface {
|
||||||
Checks() map[types.CheckID]*structs.HealthCheck
|
Checks() map[types.CheckID]*structs.HealthCheck
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start is used to start a check ttl, runs until Stop() func (c *CheckAlias) Start() {
|
// Start is used to start the check, runs until Stop() func (c *CheckAlias) Start() {
|
||||||
func (c *CheckAlias) Start() {
|
func (c *CheckAlias) Start() {
|
||||||
c.stopLock.Lock()
|
c.stopLock.Lock()
|
||||||
defer c.stopLock.Unlock()
|
defer c.stopLock.Unlock()
|
||||||
|
@ -55,7 +55,7 @@ func (c *CheckAlias) Start() {
|
||||||
go c.run(c.stopCh)
|
go c.run(c.stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop is used to stop a check ttl.
|
// Stop is used to stop the check.
|
||||||
func (c *CheckAlias) Stop() {
|
func (c *CheckAlias) Stop() {
|
||||||
c.stopLock.Lock()
|
c.stopLock.Lock()
|
||||||
defer c.stopLock.Unlock()
|
defer c.stopLock.Unlock()
|
||||||
|
@ -132,7 +132,7 @@ func (c *CheckAlias) runQuery(stopCh chan struct{}) {
|
||||||
// NOTE(mitchellh): This currently returns ALL health checks for
|
// NOTE(mitchellh): This currently returns ALL health checks for
|
||||||
// a node even though we also have the service ID. This can be
|
// a node even though we also have the service ID. This can be
|
||||||
// optimized if we introduce a new RPC endpoint to filter both,
|
// optimized if we introduce a new RPC endpoint to filter both,
|
||||||
// but for blocking queries isn't that more efficient since the checks
|
// but for blocking queries isn't that much more efficient since the checks
|
||||||
// index is global to the cluster.
|
// index is global to the cluster.
|
||||||
var out structs.IndexedHealthChecks
|
var out structs.IndexedHealthChecks
|
||||||
if err := c.RPC.RPC("Health.NodeChecks", &args, &out); err != nil {
|
if err := c.RPC.RPC("Health.NodeChecks", &args, &out); err != nil {
|
||||||
|
|
|
@ -528,7 +528,7 @@ func (l *State) UpdateCheck(id types.CheckID, status, output string) {
|
||||||
// Do not block. All notify channels should be buffered to at
|
// Do not block. All notify channels should be buffered to at
|
||||||
// least 1 in which case not-blocking does not result in loss
|
// least 1 in which case not-blocking does not result in loss
|
||||||
// of data because a failed send means a notification is
|
// of data because a failed send means a notification is
|
||||||
// already queued.
|
// already queued. This must be called with the lock held.
|
||||||
select {
|
select {
|
||||||
case notifyCh <- struct{}{}:
|
case notifyCh <- struct{}{}:
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in New Issue