Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit02b2de9

Browse files
refactor: skip reconciliation for some presets (#17595)
1 parent268a50c commit02b2de9

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

‎coderd/prebuilds/preset_snapshot.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ type ReconciliationActions struct {
7272
BackoffUntil time.Time
7373
}
7474

75+
func (ra*ReconciliationActions)IsNoop()bool {
76+
returnra.Create==0&&len(ra.DeleteIDs)==0&&ra.BackoffUntil.IsZero()
77+
}
78+
7579
// CalculateState computes the current state of prebuilds for a preset, including:
7680
// - Actual: Number of currently running prebuilds
7781
// - Desired: Number of prebuilds desired as defined in the preset

‎enterprise/coderd/prebuilds/reconcile.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,15 @@ func (c *StoreReconciler) ReconcilePreset(ctx context.Context, ps prebuilds.Pres
310310
returnnil
311311
}
312312

313+
// Nothing has to be done.
314+
if!ps.Preset.UsingActiveVersion&&actions.IsNoop() {
315+
logger.Debug(ctx,"skipping reconciliation for preset - nothing has to be done",
316+
slog.F("template_id",ps.Preset.TemplateID.String()),slog.F("template_name",ps.Preset.TemplateName),
317+
slog.F("template_version_id",ps.Preset.TemplateVersionID.String()),slog.F("template_version_name",ps.Preset.TemplateVersionName),
318+
slog.F("preset_id",ps.Preset.ID.String()),slog.F("preset_name",ps.Preset.Name))
319+
returnnil
320+
}
321+
313322
// nolint:gocritic // ReconcilePreset needs Prebuilds Orchestrator permissions.
314323
prebuildsCtx:=dbauthz.AsPrebuildsOrchestrator(ctx)
315324

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp