@@ -365,16 +365,10 @@ func (c *StoreReconciler) ReconcilePreset(ctx context.Context, ps prebuilds.Pres
365
365
c .metrics .trackHardLimitedStatus (ps .Preset .OrganizationName ,ps .Preset .TemplateName ,ps .Preset .Name ,ps .IsHardLimited )
366
366
}
367
367
368
- // If the preset was previously hard-limited, log it and exit early.
369
- if ps .Preset .PrebuildStatus == database .PrebuildStatusHardLimited {
370
- logger .Warn (ctx ,"skipping hard limited preset" )
371
- return nil
372
- }
373
-
374
368
// If the preset reached the hard failure limit for the first time during this iteration:
375
369
// - Mark it as hard-limited in the database
376
370
// - Send notifications to template admins
377
- if ps .IsHardLimited {
371
+ if ps .Preset . PrebuildStatus != database . PrebuildStatusHardLimited && ps . IsHardLimited {
378
372
logger .Warn (ctx ,"skipping hard limited preset" )
379
373
380
374
err := c .store .UpdatePresetPrebuildStatus (ctx , database.UpdatePresetPrebuildStatusParams {
@@ -388,10 +382,7 @@ func (c *StoreReconciler) ReconcilePreset(ctx context.Context, ps prebuilds.Pres
388
382
err = c .notifyPrebuildFailureLimitReached (ctx ,ps )
389
383
if err != nil {
390
384
logger .Error (ctx ,"failed to notify that number of prebuild failures reached the limit" ,slog .Error (err ))
391
- return nil
392
385
}
393
-
394
- return nil
395
386
}
396
387
397
388
state := ps .CalculateState ()
@@ -456,6 +447,14 @@ func (c *StoreReconciler) ReconcilePreset(ctx context.Context, ps prebuilds.Pres
456
447
actions .Create = desired
457
448
}
458
449
450
+ if actions .Create > 0 {
451
+ // If the preset is hard-limited, log it and exit early.
452
+ if ps .Preset .PrebuildStatus == database .PrebuildStatusHardLimited || ps .IsHardLimited {
453
+ logger .Warn (ctx ,"skipping hard limited preset" )
454
+ return nil
455
+ }
456
+ }
457
+
459
458
var multiErr multierror.Error
460
459
461
460
for range actions .Create {