mirror of
https://github.com/status-im/consul.git
synced 2025-01-14 15:54:40 +00:00
Un-nest switch in gateway update handler
This commit is contained in:
parent
2a85e44519
commit
840d27a9d5
@ -891,8 +891,8 @@ func (s *state) handleUpdateTerminatingGateway(u cache.UpdateEvent, snap *Config
|
|||||||
}
|
}
|
||||||
logger := s.logger.Named(logging.TerminatingGateway)
|
logger := s.logger.Named(logging.TerminatingGateway)
|
||||||
|
|
||||||
switch u.CorrelationID {
|
switch {
|
||||||
case rootsWatchID:
|
case u.CorrelationID == rootsWatchID:
|
||||||
roots, ok := u.Result.(*structs.IndexedCARoots)
|
roots, ok := u.Result.(*structs.IndexedCARoots)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("invalid type for response: %T", u.Result)
|
return fmt.Errorf("invalid type for response: %T", u.Result)
|
||||||
@ -900,7 +900,7 @@ func (s *state) handleUpdateTerminatingGateway(u cache.UpdateEvent, snap *Config
|
|||||||
snap.Roots = roots
|
snap.Roots = roots
|
||||||
|
|
||||||
// Update watches based on the current list of services associated with the terminating-gateway
|
// Update watches based on the current list of services associated with the terminating-gateway
|
||||||
case gatewayServicesWatchID:
|
case u.CorrelationID == gatewayServicesWatchID:
|
||||||
services, ok := u.Result.(*structs.IndexedGatewayServices)
|
services, ok := u.Result.(*structs.IndexedGatewayServices)
|
||||||
if !ok {
|
if !ok {
|
||||||
return fmt.Errorf("invalid type for response: %T", u.Result)
|
return fmt.Errorf("invalid type for response: %T", u.Result)
|
||||||
@ -1052,9 +1052,6 @@ func (s *state) handleUpdateTerminatingGateway(u cache.UpdateEvent, snap *Config
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
|
||||||
switch {
|
|
||||||
// Store service instances for watched service
|
|
||||||
case strings.HasPrefix(u.CorrelationID, "external-service:"):
|
case strings.HasPrefix(u.CorrelationID, "external-service:"):
|
||||||
resp, ok := u.Result.(*structs.IndexedCheckServiceNodes)
|
resp, ok := u.Result.(*structs.IndexedCheckServiceNodes)
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -1097,7 +1094,6 @@ func (s *state) handleUpdateTerminatingGateway(u cache.UpdateEvent, snap *Config
|
|||||||
default:
|
default:
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user