Skip to content

Commit

Permalink
Don't do an entity read when entity is an agent (#3581)
Browse files Browse the repository at this point in the history
* Don't do an entity read when entity is an agent

Signed-off-by: Eric Chlebek <[email protected]>
  • Loading branch information
echlebek authored Feb 25, 2020
1 parent d071208 commit 4de7b0c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions backend/eventd/entity.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ func createProxyEntity(event *corev2.Event, s store.EntityStore) error {
// Override the entity name with proxy_entity_name if it was provided
if event.HasCheck() && event.Check.ProxyEntityName != "" {
entityName = event.Check.ProxyEntityName
} else if event.Entity.EntityClass == corev2.EntityAgentClass {
return nil
}

// Determine if the entity exists
Expand Down
3 changes: 2 additions & 1 deletion backend/eventd/eventd.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ func (e *Eventd) handleMessage(msg interface{}) error {

ctx := context.WithValue(context.Background(), corev2.NamespaceKey, event.Entity.Namespace)

// Create a proxy entity if required and update the event's entity with it
// Create a proxy entity if required and update the event's entity with it,
// but only if the event's entity is not an agent.
if err := createProxyEntity(event, e.store); err != nil {
return err
}
Expand Down

0 comments on commit 4de7b0c

Please sign in to comment.