8000 feat: add killswitch for notifications by mtojek · Pull Request #13794 · coder/coder · GitHub
[go: up one dir, main page]

Skip to content

feat: add killswitch for notifications #13794

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Jul 10, 2024
Merged
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
return true
  • Loading branch information
mtojek committed Jul 10, 2024
commit 25223663f7f4cc7dbdeaf113305ea428effe0f24
14 changes: 8 additions & 6 deletions coderd/notifications/notifier.go
6CA4
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (n *notifier) run(ctx context.Context, success chan<- dispatchResult, failu
// Check if notifier is not paused.
ok, err := n.ensureRunning(ctx)
if err != nil {
n.log.Error(ctx, "failed to check notifier state", slog.Error(err))
n.log.Warn(ctx, "failed to check notifier state", slog.Error(err))
}

if ok {
Expand Down Expand Up @@ -107,11 +107,13 @@ func (n *notifier) ensureRunning(ctx context.Context) (bool, error) {
}

var settings codersdk.NotificationsSettings
if len(settingsJSON) > 0 {
err = json.Unmarshal([]byte(settingsJSON), &settings)
if err != nil {
return false, xerrors.Errorf("unmarshal notifications settings")
}
if len(settingsJSON) == 0 {
return true, nil // settings.NotifierPaused is false by default
}

err = json.Unmarshal([]byte(settingsJSON), &settings)
if err != nil {
return false, xerrors.Errorf("unmarshal notifications settings")
}

if settings.NotifierPaused {
Expand Down
Loading
0