mirror of https://github.com/hashicorp/consul
state: Include the override key in the sorting of events
Co-Authored-By: Kyle Havlovitz <kylehav@gmail.com>pull/9671/head
parent
c2481ca10f
commit
eb58a39738
|
@ -24,6 +24,7 @@ type EventPayloadCheckServiceNode struct {
|
|||
// events in the connect topic to specify the name of the underlying service
|
||||
// when the change event is for a sidecar or gateway.
|
||||
key string
|
||||
// FIXME: we need to be able to override the namespace for some terminating gateway events
|
||||
}
|
||||
|
||||
func (e EventPayloadCheckServiceNode) HasReadPermission(authz acl.Authorizer) bool {
|
||||
|
@ -454,9 +455,10 @@ func copyEventForService(event stream.Event, service structs.ServiceName) stream
|
|||
event.Topic = topicServiceHealthConnect
|
||||
payload := event.Payload.(EventPayloadCheckServiceNode)
|
||||
payload.key = service.Name
|
||||
event.Payload = payload
|
||||
// FIXME: we need payload to have an override for namespace, so that it can be filtered
|
||||
// properly by EventPayloadCheckServiceNode.MatchesKey
|
||||
// payload.enterpriseMeta = service.EnterpriseMeta
|
||||
event.Payload = payload
|
||||
return event
|
||||
}
|
||||
|
||||
|
|
|
@ -1196,7 +1196,7 @@ var cmpPartialOrderEvents = cmp.Options{
|
|||
cmpopts.SortSlices(func(i, j stream.Event) bool {
|
||||
key := func(e stream.Event) string {
|
||||
csn := getPayloadCheckServiceNode(e.Payload)
|
||||
return fmt.Sprintf("%s/%s/%s", e.Topic, csn.Node.Node, csn.Service.Service)
|
||||
return fmt.Sprintf("%s/%s/%s/%s", e.Topic, csn.Node.Node, csn.Service.Service, e.Payload.(EventPayloadCheckServiceNode).key)
|
||||
}
|
||||
return key(i) < key(j)
|
||||
}),
|
||||
|
|
Loading…
Reference in New Issue