Skip to content

APIGOV-33163 - new event kind handler structure#1059

Open
dgghinea wants to merge 13 commits into
mainfrom
APIGOV-33163
Open

APIGOV-33163 - new event kind handler structure#1059
dgghinea wants to merge 13 commits into
mainfrom
APIGOV-33163

Conversation

@dgghinea

Copy link
Copy Markdown
Collaborator

No description provided.

Comment thread pkg/agent/handler/accessrequest.go Outdated
@dgghinea
dgghinea marked this pull request as ready for review July 16, 2026 15:10
Comment thread pkg/agent/discoverycache.go Outdated
Comment thread pkg/agent/cachevalidationjob.go Outdated

cachedSeq := cv.sequence.GetSequence()
if serverSeq != cachedSeq {
// At start-up or agent restart, because of the status change event, the serverSeq will always be higher with 1 than the cachedSeq.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe just a comment thing for me. looks like this code is also called from validateAndRebuildCache. So this +1 tolerance is also processing every mid run reconnect as well, no?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think mid run reconnects would happen in case the watch controller context gets cancelled(SDK stream client timeout), which would mark the agent as stopped and still trigger a status change to Stopped

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this +1 check is not needed. Watch-controller agent status update will not raise events, so the sequence should be same

@dgghinea dgghinea Jul 20, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm... weird. I was permanently getting sequence mismatches(+1 difference) during testing and my assumption was that this was the reason. I guess I'll revert it then

}
}

func (h *discoveryManagedApplication) ShouldHandle(ctx context.Context, event *proto.Event) bool {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't know if i'm seeing this correctly. Could you take another look at the ShouldHandle here (and the same pattern in discoveryaccessrequest.go:24, tracemanagedapplication.go:24, and traceaccessrequest.go:27)?

It returns false once h.cache.GetManagedApplication(event.Payload.Metadata.Id) finds an existing entry. But what about the DELETE action. Since Handle() never runs when ShouldHandle() returns false, it looks like once a resource is cached, later update and delete events for that same ID might not get processed by this handler anymore??? That's what i'm seeing. Just checking in case it's worth a second pass.. could be intentional, but wanted to double check it.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm... I was trying to not change the old behaviour for this code. I think we're not interested in any updates apart from the resource itself being there.
Regarding your statement for the DELETE action, you're right. good call

Comment thread pkg/agent/handler/agentresource.go Outdated
jcollins-axway
jcollins-axway previously approved these changes Jul 16, 2026
jcollins-axway
jcollins-axway previously approved these changes Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants