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

Commit5bffd26

Browse files
committed
Ensuring done channel cannot be closed twice
Signed-off-by: Danny Kopping <danny@coder.com>
1 parent0107ad1 commit5bffd26

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

‎coderd/notifications/manager.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ type Manager struct {
5454

5555
runOnce sync.Once
5656
stopOnce sync.Once
57+
doneOnce sync.Once
5758
stopchanany
5859
donechanany
5960

@@ -153,9 +154,9 @@ func (m *Manager) Run(ctx context.Context) {
153154
// events, creating a notifier, and publishing bulk dispatch result updates to the store.
154155
func (m*Manager)loop(ctx context.Context)error {
155156
deferfunc() {
156-
ifm.notifier!=nil {
157+
m.doneOnce.Do(func() {
157158
close(m.done)
158-
}
159+
})
159160
m.log.Info(context.Background(),"notification manager stopped")
160161
}()
161162

@@ -363,11 +364,13 @@ func (m *Manager) Stop(ctx context.Context) error {
363364

364365
m.log.Info(context.Background(),"graceful stop requested")
365366

367+
m.doneOnce.Do(func() {
368+
close(m.done)
369+
})
370+
366371
// If the notifier hasn't been started, we don't need to wait for anything.
367372
// This is only really during testing when we want to enqueue messages only but not deliver them.
368-
ifm.notifier==nil {
369-
close(m.done)
370-
}else {
373+
ifm.notifier!=nil {
371374
m.notifier.stop()
372375
}
373376

‎site/src/pages/DeploySettingsPage/Sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ import NotificationsIcon from "@mui/icons-material/NotificationsNoneOutlined";
77
importGlobefrom"@mui/icons-material/PublicOutlined";
88
importApprovalIconfrom"@mui/icons-material/VerifiedUserOutlined";
99
importVpnKeyOutlinedfrom"@mui/icons-material/VpnKeyOutlined";
10+
import{FeatureStageBadge}from"components/FeatureStageBadge/FeatureStageBadge";
1011
import{GitIcon}from"components/Icons/GitIcon";
1112
import{
1213
SidebarasBaseSidebar,
1314
SidebarNavItem,
1415
}from"components/Sidebar/Sidebar";
1516
import{useDashboard}from"modules/dashboard/useDashboard";
1617
importtype{FC}from"react";
17-
import{FeatureStageBadge}from"components/FeatureStageBadge/FeatureStageBadge";
1818

1919
exportconstSidebar:FC=()=>{
2020
const{ experiments}=useDashboard();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp