Skip to content

refactor: consolidate instance merging logic and add unit tests#62602

Merged
Tener merged 1 commit intomasterfrom
tener/discovery-status-refactor
Jan 8, 2026
Merged

refactor: consolidate instance merging logic and add unit tests#62602
Tener merged 1 commit intomasterfrom
tener/discovery-status-refactor

Conversation

@Tener
Copy link
Copy Markdown
Contributor

@Tener Tener commented Jan 5, 2026

I found myself adding yet another copy of discover...UserTaskAddExistingInstances for another PR I'm working on, so instead I extracted the mergeExistingInstances instead, replacing current 3 variant implementations.

I also fixed what I believe is incorrect merge of old and new data by making this conditional:

// Merge existing cluster state into in-memory object.
failedClusters.Clusters[existingClusterName] = existingCluster

like this:

// Merge existing cluster state into in-memory object, but only if we don't have a fresh key.
if _, found := freshInstances[instanceKey]; !found {
	freshInstances[instanceKey] = instance
}

Changelog: Fixed potential delay in updating User Task status for Discovery resources.

@Tener
Copy link
Copy Markdown
Contributor Author

Tener commented Jan 7, 2026

@nklaassen gentle ping.

@public-teleport-github-review-bot public-teleport-github-review-bot bot removed the request for review from nklaassen January 7, 2026 14:29
@Tener Tener added this pull request to the merge queue Jan 7, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 7, 2026
@Tener Tener added this pull request to the merge queue Jan 8, 2026
Merged via the queue into master with commit a0bafe9 Jan 8, 2026
45 of 47 checks passed
@Tener Tener deleted the tener/discovery-status-refactor branch January 8, 2026 10:23
@backport-bot-workflows
Copy link
Copy Markdown
Contributor

@Tener See the table below for backport results.

Branch Result
branch/v18 Create PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants