Skip to content

Commit 80e52ee

Browse files
minor fixes
1 parent a93b654 commit 80e52ee

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

enterprise/coderd/prebuilds/reconcile.go

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -619,14 +619,17 @@ func (c *StoreReconciler) executeReconciliationAction(ctx context.Context, logge
619619
// Unexpected things happen (i.e. bugs or bitflips); let's defend against disastrous outcomes.
620620
// See https://blog.robertelder.org/causes-of-bit-flips-in-computer-memory/.
621621
// This is obviously not comprehensive protection against this sort of problem, but this is one essential check.
622-
// TODO: uncomment:
623-
// desired := ps.Preset.DesiredInstances.Int32
624-
// if action.Create > desired {
625-
// logger.Critical(ctx, "determined excessive count of prebuilds to create; clamping to desired count",
626-
// slog.F("create_count", action.Create), slog.F("desired_count", desired))
627-
//
628-
// action.Create = desired
629-
//}
622+
desired, err := ps.CalculateDesiredInstances(c.clock.Now())
623+
if err != nil {
624+
return xerrors.Errorf("failed to calculate desired instances: %w", err)
625+
}
626+
627+
if action.Create > desired {
628+
logger.Critical(ctx, "determined excessive count of prebuilds to create; clamping to desired count",
629+
slog.F("create_count", action.Create), slog.F("desired_count", desired))
630+
631+
action.Create = desired
632+
}
630633

631634
// If preset is hard-limited, and it's a create operation, log it and exit early.
632635
// Creation operation is disallowed for hard-limited preset.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy