Skip to content

refactor: skip reconciliation for some presets #17595

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2025

Conversation

evgeniy-scherbina
Copy link
Contributor

No description provided.

@@ -310,6 +310,15 @@ func (c *StoreReconciler) ReconcilePreset(ctx context.Context, ps prebuilds.Pres
return nil
}

// Nothing has to be done.
if !ps.Preset.UsingActiveVersion && actions.IsNoop() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dannykopping Do we need !ps.Preset.UsingActiveVersion? I think we can skip reconciliation for all presets if actions.IsNoop() == true?

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess, yeah, but if the preset is part of an inactive version then we shouldn't be logging anything for that; for active presets which have no operations to perform, that's at least diagnostically useful.

Consider an installation that's been using prebuilds for a while and they have >100 inactive preset versions; that'll log a tonne for no value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay, let's keep it as it is

Copy link
Contributor Author

@evgeniy-scherbina evgeniy-scherbina Apr 29, 2025

Choose a reason for hiding this comment

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

I mean here we log with debug level which is probably okay?

// Nothing has to be done.
if !ps.Preset.UsingActiveVersion && actions.IsNoop() {
	logger.Debug(ctx, "skipping reconciliation for preset - nothing has to be done",
		slog.F("template_id", ps.Preset.TemplateID.String()), slog.F("template_name", ps.Preset.TemplateName),
		slog.F("template_version_id", ps.Preset.TemplateVersionID.String()), slog.F("template_version_name", ps.Preset.TemplateVersionName),
		slog.F("preset_id", ps.Preset.ID.String()), slog.F("preset_name", ps.Preset.Name))
	return nil
}

and then exit early without additional logs with info/warn log level

Or you wanted to delete debug log as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope we can keep the debug log 👍

@evgeniy-scherbina evgeniy-scherbina marked this pull request as ready for review April 28, 2025 20:51
@evgeniy-scherbina evgeniy-scherbina changed the title refactor: skipping reconciliation for some of the presets refactor: skip reconciliation for some presets Apr 28, 2025
@evgeniy-scherbina evgeniy-scherbina merged commit 02b2de9 into main Apr 29, 2025
40 checks passed
@evgeniy-scherbina evgeniy-scherbina deleted the yevhenii/510-reconciliation-loop branch April 29, 2025 11:55
@github-actions github-actions bot locked and limited conversation to collaborators Apr 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants