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

Commit92b5e63

Browse files
fix: throttle-prebuild-notifications
1 parentd61353f commit92b5e63

File tree

12 files changed

+208
-8
lines changed

12 files changed

+208
-8
lines changed

‎coderd/database/dbauthz/dbauthz.go‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2636,6 +2636,10 @@ func (q *querier) GetTemplateParameterInsights(ctx context.Context, arg database
26362636
returnq.db.GetTemplateParameterInsights(ctx,arg)
26372637
}
26382638

2639+
func (q*querier)GetTemplatePrebuildNotificationCooldown(ctx context.Context,arg database.GetTemplatePrebuildNotificationCooldownParams) (database.TemplatePrebuildNotificationCooldown,error) {
2640+
panic("not implemented")
2641+
}
2642+
26392643
func (q*querier)GetTemplatePresetsWithPrebuilds(ctx context.Context,templateID uuid.NullUUID) ([]database.GetTemplatePresetsWithPrebuildsRow,error) {
26402644
// GetTemplatePresetsWithPrebuilds retrieves template versions with configured presets and prebuilds.
26412645
// Presets and prebuilds are part of the template, so if you can access templates - you can access them as well.
@@ -5123,6 +5127,10 @@ func (q *querier) UpsertTelemetryItem(ctx context.Context, arg database.UpsertTe
51235127
returnq.db.UpsertTelemetryItem(ctx,arg)
51245128
}
51255129

5130+
func (q*querier)UpsertTemplatePrebuildNotificationCooldown(ctx context.Context,arg database.UpsertTemplatePrebuildNotificationCooldownParams)error {
5131+
panic("not implemented")
5132+
}
5133+
51265134
func (q*querier)UpsertTemplateUsageStats(ctx context.Context)error {
51275135
iferr:=q.authorizeContext(ctx,policy.ActionUpdate,rbac.ResourceSystem);err!=nil {
51285136
returnerr

‎coderd/database/dbmem/dbmem.go‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6181,6 +6181,15 @@ func (q *FakeQuerier) GetTemplateParameterInsights(ctx context.Context, arg data
61816181
returnrows,nil
61826182
}
61836183

6184+
func (q*FakeQuerier)GetTemplatePrebuildNotificationCooldown(ctx context.Context,arg database.GetTemplatePrebuildNotificationCooldownParams) (database.TemplatePrebuildNotificationCooldown,error) {
6185+
err:=validateDatabaseType(arg)
6186+
iferr!=nil {
6187+
return database.TemplatePrebuildNotificationCooldown{},err
6188+
}
6189+
6190+
panic("not implemented")
6191+
}
6192+
61846193
func (*FakeQuerier)GetTemplatePresetsWithPrebuilds(_ context.Context,_ uuid.NullUUID) ([]database.GetTemplatePresetsWithPrebuildsRow,error) {
61856194
returnnil,ErrUnimplemented
61866195
}
@@ -12555,6 +12564,15 @@ func (q *FakeQuerier) UpsertTelemetryItem(_ context.Context, arg database.Upsert
1255512564
returnnil
1255612565
}
1255712566

12567+
func (q*FakeQuerier)UpsertTemplatePrebuildNotificationCooldown(ctx context.Context,arg database.UpsertTemplatePrebuildNotificationCooldownParams)error {
12568+
err:=validateDatabaseType(arg)
12569+
iferr!=nil {
12570+
returnerr
12571+
}
12572+
12573+
panic("not implemented")
12574+
}
12575+
1255812576
func (q*FakeQuerier)UpsertTemplateUsageStats(ctx context.Context)error {
1255912577
q.mutex.Lock()
1256012578
deferq.mutex.Unlock()

‎coderd/database/dbmetrics/querymetrics.go‎

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/dump.sql‎

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
DROPTABLE IF EXISTS template_prebuild_notification_cooldowns;
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CREATETABLEtemplate_prebuild_notification_cooldowns (
2+
template_id UUIDNOT NULL,
3+
notification_typeTEXTNOT NULL,
4+
last_notification_sentTIMESTAMPTZNOT NULL,
5+
PRIMARY KEY (template_id, notification_type)
6+
);
7+
8+
COMMENT ON TABLE template_prebuild_notification_cooldowns IS'Tracks when prebuild failure notifications were last sent to prevent notification noise';
9+
COMMENT ON COLUMN template_prebuild_notification_cooldowns.notification_type IS'Type of notification: admin or author';

‎coderd/database/models.go‎

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/querier.go‎

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries.sql.go‎

Lines changed: 38 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries/prebuilds.sql‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,17 @@ INNER JOIN organizations o ON o.id = w.organization_id
188188
WHERE NOTt.deletedANDwpb.build_number=1
189189
GROUP BYt.name,tvp.name,o.name
190190
ORDER BYt.name,tvp.name,o.name;
191+
192+
-- name: GetTemplatePrebuildNotificationCooldown :one
193+
SELECT*FROM template_prebuild_notification_cooldowns
194+
WHERE template_id= $1AND notification_type= $2;
195+
196+
-- name: UpsertTemplatePrebuildNotificationCooldown :exec
197+
INSERT INTO template_prebuild_notification_cooldowns (
198+
template_id,
199+
notification_type,
200+
last_notification_sent
201+
)VALUES (
202+
$1, $2, NOW()
203+
)ON CONFLICT (template_id, notification_type) DOUPDATESET
204+
last_notification_sent= NOW();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp