Allow notification batching#53
Conversation
There was a problem hiding this comment.
Pull request overview
Adds protocol support for batching multiple ServerMessage notifications into a single wire frame while aiming to remain backward-compatible with peers that don’t support batching.
Changes:
- Introduces
ServerMessage.NotificationBatchand a newnotification_batchvariant inServerMessage.contentoneof. - Updates generated Elixir protobuf module to include the new message/oneof variant (and adds an opt-in flag in
AuthRequest). - Updates generated protocol documentation (
doc/docs.md) to document the new batch message/variant.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| fishjam_protos/lib/fishjam/server_notifications.pb.ex | Adds generated Elixir definitions for NotificationBatch and notification_batch (also adds supports_notification_batch to AuthRequest). |
| fishjam/server_notifications.proto | Defines ServerMessage.NotificationBatch and exposes it in the ServerMessage oneof as notification_batch = 33. |
| doc/docs.md | Documents ServerMessage.NotificationBatch and adds it to the ServerMessage oneof table and ToC. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Curious if all notifications will be batched after this change? @roznawsk |
|
@Critteros |
What would be the interval between batches? Some of the received notifications might require immediate dispatch like |
|
As the first iteration we could not introduce any interval. In such case, the interval would be the time to send single webhook. We would send all queued notifications for the given room/stream, wait for the request to complete, repeat 🔁 |
Sounds good, this should also have an positive impact on the overall latency as queue will be emptied faster |
Description
against the old schema.
Considered alternatives
recursion, but every new notification has to be added in two places with
matching tags — too costly to maintain.
non-recursion for free, but forces the receiving side to know which message type is being received at the moment
Trade-off accepted: schema permits a batch-of-batches; doc comment forbids it.
Reuse of ServerMessage keeps future notifications a one-line addition.
Motivation and Context
Why is this change required? What problem does it solve? If it fixes an open
issue, please link to the issue here.
Documentation impact