-
-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
When notification arrives, we should debounce them.
For that, store notification tokens in a binary tree or binary heap sorted by timestamp of their last notification. At the same time maintain a set of all tokens which are currently in the heap (the values).
When a new notification arrives, first clean up the heap by removing tokens that have been notified >10 seconds ago and corresponding set entries. Then check the set, if it still has the token, do not notify.
If the set does not have the token, the notification is not debounced. Notify and on success insert the token both into the binary tree and in the set.
We also need metrics:
- Gauge for the number of tokens currently in the set.
- Counter for the number of debounced notifications.
Metadata
Metadata
Assignees
Labels
No labels