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

Commitae7135c

Browse files
minor refactoring
1 parentaff96c5 commitae7135c

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

‎enterprise/coderd/prebuilds/reconcile.go‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -489,13 +489,13 @@ func (c *StoreReconciler) notifyPrebuildFailureLimitReached(ctx context.Context,
489489
returnnil
490490
}
491491

492-
// Send notification to template admins (7-day cooldown)
492+
// Send notification to template admins
493493
err:=c.notifyTemplateAdmins(ctx,ps)
494494
iferr!=nil {
495495
returnxerrors.Errorf("notify template admins: %w",err)
496496
}
497497

498-
// Send notification to template version author (1-day cooldown)
498+
// Send notification to template version author
499499
err=c.notifyTemplateAuthor(ctx,ps)
500500
iferr!=nil {
501501
returnxerrors.Errorf("notify template author: %w",err)
@@ -505,13 +505,13 @@ func (c *StoreReconciler) notifyPrebuildFailureLimitReached(ctx context.Context,
505505
}
506506

507507
func (c*StoreReconciler)notifyTemplateAdmins(ctx context.Context,ps prebuilds.PresetSnapshot)error {
508-
// Check7-daycooldown for admin notifications
508+
// Check cooldown for admin notifications
509509
cooldown,err:=c.store.GetTemplatePrebuildNotificationCooldown(ctx, database.GetTemplatePrebuildNotificationCooldownParams{
510510
TemplateID:ps.Preset.TemplateID,
511511
NotificationType:NotificationTypeAdmin,
512512
})
513513
iferr==nil {
514-
// Cooldown exists, check if7 days have passed
514+
// Cooldown exists, check ifit has passed
515515
ifc.clock.Since(cooldown.LastNotificationSent)<AdminNotificationCooldown {
516516
returnnil// Still in cooldown
517517
}
@@ -551,13 +551,13 @@ func (c *StoreReconciler) notifyTemplateAdmins(ctx context.Context, ps prebuilds
551551
}
552552

553553
func (c*StoreReconciler)notifyTemplateAuthor(ctx context.Context,ps prebuilds.PresetSnapshot)error {
554-
// Check1-daycooldown for author notifications
554+
// Check cooldown for author notifications
555555
cooldown,err:=c.store.GetTemplatePrebuildNotificationCooldown(ctx, database.GetTemplatePrebuildNotificationCooldownParams{
556556
TemplateID:ps.Preset.TemplateID,
557557
NotificationType:NotificationTypeAuthor,
558558
})
559559
iferr==nil {
560-
// Cooldown exists, check if1 day has passed
560+
// Cooldown exists, check ifit has passed
561561
ifc.clock.Since(cooldown.LastNotificationSent)<AuthorNotificationCooldown {
562562
returnnil// Still in cooldown
563563
}

‎enterprise/coderd/prebuilds/reconcile_test.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,8 +1057,8 @@ func TestHardLimitedPresetNotifications(t *testing.T) {
10571057
// both template admin and template version author should receive notification
10581058
require.Len(t,matching,2)
10591059

1060-
// Advance clockone week aheadto reset cooldown period.
1061-
clock.Advance(time.Hour*24*7+time.Second).MustWait(ctx)
1060+
// Advance clock to reset cooldown period.
1061+
clock.Advance(prebuilds.AdminNotificationCooldown+time.Second).MustWait(ctx)
10621062
// After 3rd call of triggerNotif - 2 new notifications should be sent (total is 4 notifications). Because cooldown period was reset.
10631063
triggerNotif()
10641064
// When hard limit is reached, a notification should be sent.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp