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

Commit7e5b4cc

Browse files
committed
make gen
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent7db2e56 commit7e5b4cc

File tree

3 files changed

+7
-10
lines changed

3 files changed

+7
-10
lines changed

‎coderd/database/queries.sql.go

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

‎coderd/notifications/manager.go

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ type Manager struct {
6060
// helpers is a map of template helpers which are used to customize notification messages to use global settings like
6161
// access URL etc.
6262
funcNewManager(cfg codersdk.NotificationsConfig,storeStore,metrics*Metrics,log slog.Logger) (*Manager,error) {
63-
ifmetrics==nil {
64-
panic("nil metrics passed to notifications manager")
65-
}
66-
6763
method,err:=dispatchMethodFromCfg(cfg)
6864
iferr!=nil {
6965
returnnil,err
@@ -211,6 +207,11 @@ func (m *Manager) BufferedUpdatesCount() (success int, failure int) {
211207

212208
// syncUpdates updates messages in the store based on the given successful and failed message dispatch results.
213209
func (m*Manager)syncUpdates(ctx context.Context) {
210+
// Ensure we update the metrics to reflect the current state after each invocation.
211+
deferfunc() {
212+
m.metrics.PendingUpdates.Set(float64(len(m.success)+len(m.failure)))
213+
}()
214+
214215
select {
215216
case<-ctx.Done():
216217
return
@@ -220,10 +221,6 @@ func (m *Manager) syncUpdates(ctx context.Context) {
220221
nSuccess:=len(m.success)
221222
nFailure:=len(m.failure)
222223

223-
deferfunc() {
224-
m.metrics.PendingUpdates.Set(float64(len(m.success)+len(m.failure)))
225-
}()
226-
227224
// Nothing to do.
228225
ifnSuccess+nFailure==0 {
229226
return

‎coderd/notifications/notifications_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,6 @@ func TestInvalidConfig(t *testing.T) {
516516
cfg.LeasePeriod=serpent.Duration(leasePeriod)
517517
cfg.DispatchTimeout=serpent.Duration(leasePeriod)
518518

519-
// TODO
520519
_,err:=notifications.NewManager(cfg,db,createMetrics(),logger.Named("manager"))
521520
require.ErrorIs(t,err,notifications.ErrInvalidDispatchTimeout)
522521
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp