Skip to content
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

Adopt ring buf for queued notifications #188

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mlw
Copy link
Contributor

@mlw mlw commented Dec 27, 2024

This change makes the SNTNotificationQueue use a ring buffer for storing queued messages instead of an array. This means that the most recent notifications will be displayed when a user logs in and the oldest ones will be dropped.

@mlw mlw added this to the 2025.1 milestone Dec 27, 2024
@github-actions github-actions bot added comp/santad Issues or PRs related to the daemon size/l Size: large labels Dec 27, 2024
@mlw mlw force-pushed the notify-queue-ring-buf branch from a8b2f10 to 347720f Compare December 27, 2024 18:06
@mlw mlw marked this pull request as ready for review December 27, 2024 20:34
@mlw mlw requested a review from a team as a code owner December 27, 2024 20:34

/// For each pending notification, call the reply block if set then clear the
/// reply so it won't be called again when the notification is eventually sent.
- (void)clearAllPendingRepliesLocked {
Copy link
Contributor

Choose a reason for hiding this comment

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

The "locked" in this method name (and flushQueueLocked) is a little confusing as there isn't a lock held

Copy link
Contributor

Choose a reason for hiding this comment

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

We have a few of those in the code base, by convention they assume that you've already locked the resource.

Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed offilne: none of these cases with the 'Locked' suffix are using locks explicitly but are only being done on serialized queues, so safety-wise it's OK. Switching the naming to be clearer might be beneficial but is not pressing.


/// For each pending notification, call the reply block if set then clear the
/// reply so it won't be called again when the notification is eventually sent.
- (void)clearAllPendingRepliesLocked {
Copy link
Contributor

Choose a reason for hiding this comment

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

Discussed offilne: none of these cases with the 'Locked' suffix are using locks explicitly but are only being done on serialized queues, so safety-wise it's OK. Switching the naming to be clearer might be beneficial but is not pressing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp/santad Issues or PRs related to the daemon size/l Size: large
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants