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

feat: add killswitch for notifications #13794

merged 22 commits into from
Jul 10, 2024

Conversation

mtojek
Copy link
Member

@mtojek mtojek commented Jul 5, 2024

Related: coder/internal#4
Blocked: #13537

This PR introduces API endpoints to pause/unpause the notifier. The setting is stored in the database. In the follow up I will add CLI support to control the setting.

@mtojek mtojek self-assigned this Jul 5, 2024
@mtojek mtojek changed the base branch from main to dk/notifications July 5, 2024 14:20
@mtojek mtojek changed the base branch from dk/notifications to main July 5, 2024 14:20
@mtojek mtojek changed the base branch from main to dk/system-notifications-lib July 8, 2024 07:52
Base automatically changed from dk/system-notifications-lib to main July 8, 2024 13:38
@mtojek mtojek marked this pull request as ready for review July 9, 2024 12:12
@mtojek mtojek requested a review from dannykopping July 9, 2024 12:20
Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks good! Mostly small comments and a few nits.

Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Last couple nits, none of them blocking

@mtojek
Copy link
Member Author

mtojek commented Jul 10, 2024

@dannykopping It looks like there is some flakiness around bulkUpdate? https://github.com/coder/coder/actions/runs/9874898408/job/27270328403?pr=13794. Not sure what is the root cause of messages not being dequeued.

    t.go:99: 2024-07-10 13:15:17.886 [debu]  manager.notifier: dispatch completed  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26  count=1
    t.go:99: 2024-07-10 13:15:17.887 [debu]  manager.notifier: check if notifier is paused  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26
    t.go:99: 2024-07-10 13:15:17.887 [debu]  manager.notifier: attempting to dequeue messages  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26
    t.go:99: 2024-07-10 13:15:17.887 [debu]  manager.notifier: dequeued messages  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26  count=1
    t.go:99: 2024-07-10 13:15:17.887 [debu]  manager.notifier: message dispatch succeeded  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26  msg_id=4681beed-a763-41a1-badc-b205bfe03ed8  method=smtp
    t.go:99: 2024-07-10 13:15:17.887 [debu]  manager.notifier: dispatch completed  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26  count=1
    t.go:99: 2024-07-10 13:15:17.887 [debu]  manager.notifier: check if notifier is paused  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26
    t.go:99: 2024-07-10 13:15:17.887 [debu]  manager.notifier: attempting to dequeue messages  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26
    t.go:99: 2024-07-10 13:15:17.887 [debu]  manager.notifier: dequeued messages  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26  count=1
    t.go:99: 2024-07-10 13:15:17.887 [debu]  manager.notifier: message dispatch succeeded  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26  msg_id=4681beed-a763-41a1-badc-b205bfe03ed8  method=smtp
    t.go:99: 2024-07-10 13:15:17.906 [debu]  enqueuer: enqueued notification  msg_id=74f1fd65-d602-42e4-87c9-a83a91abba9f
    t.go:99: 2024-07-10 13:15:19.881 [debu]  manager: bulk update completed  type=update_sent  updated=-1
    t.go:99: 2024-07-10 13:15:19.881 [debu]  manager.notifier: dispatch completed  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26  count=1
    t.go:99: 2024-07-10 13:15:19.882 [debu]  manager.notifier: check if notifier is paused  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26
    t.go:99: 2024-07-10 13:15:19.882 [debu]  manager.notifier: attempting to dequeue messages  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26
    t.go:99: 2024-07-10 13:15:19.882 [debu]  manager.notifier: dequeued messages  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26  count=2
    t.go:99: 2024-07-10 13:15:19.882 [debu]  manager.notifier: message dispatch succeeded  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26  msg_id=74f1fd65-d602-42e4-87c9-a83a91abba9f  method=smtp
    t.go:99: 2024-07-10 13:15:19.882 [debu]  manager.notifier: message dispatch succeeded  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26  msg_id=4681beed-a763-41a1-badc-b205bfe03ed8  method=smtp
    t.go:99: 2024-07-10 13:15:19.882 [debu]  manager.notifier: dispatch completed  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26  count=2
    t.go:99: 2024-07-10 13:15:19.882 [debu]  manager.notifier: check if notifier is paused  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26
    t.go:99: 2024-07-10 13:15:19.882 [debu]  manager.notifier: attempting to dequeue messages  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26
    t.go:99: 2024-07-10 13:15:19.882 [debu]  manager.notifier: dequeued messages  notifier_id=97bfe604-a0be-4caf-b276-db37b98e3a26  count=2

@mtojek mtojek requested a review from dannykopping July 10, 2024 14:09
Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mtojek mtojek merged commit bf392ff into main Jul 10, 2024
30 of 32 checks passed
@mtojek mtojek deleted the 4-pause-1 branch July 10, 2024 14:15
@github-actions github-actions bot locked and limited conversation to collaborators Jul 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants