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

Commitf8f5e68

Browse files
committed
fix: remove closed check when starting notification manager
1 parent628b81c commitf8f5e68

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

‎coderd/notifications/manager.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ type Manager struct {
5353
success,failurechandispatchResult
5454

5555
mu sync.Mutex// Protects following.
56-
closedbool
5756
notifier*notifier
5857

5958
runOnce sync.Once
@@ -161,11 +160,6 @@ func (m *Manager) loop(ctx context.Context) error {
161160
}()
162161

163162
m.mu.Lock()
164-
ifm.closed {
165-
m.mu.Unlock()
166-
returnxerrors.New("manager already closed")
167-
}
168-
169163
vareg errgroup.Group
170164

171165
m.notifier=newNotifier(ctx,m.cfg,uuid.New(),m.log,m.store,m.handlers,m.helpers,m.metrics,m.clock)
@@ -354,12 +348,13 @@ func (m *Manager) Stop(ctx context.Context) error {
354348
m.mu.Lock()
355349
deferm.mu.Unlock()
356350

357-
ifm.closed {
351+
m.log.Debug(context.Background(),"graceful stop requested")
352+
353+
select {
354+
case<-m.stop:
358355
returnnil
356+
default:
359357
}
360-
m.closed=true
361-
362-
m.log.Debug(context.Background(),"graceful stop requested")
363358

364359
// If the notifier hasn't been started, we don't need to wait for anything.
365360
// This is only really during testing when we want to enqueue messages only but not deliver them.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp