-
Notifications
You must be signed in to change notification settings - Fork 452
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
⚡️ Avoid repeat subscription requests
At the moment, if a `Presence` instance is already subscribed, calling `presence.subscribe()` will send another subscription request, which can cause unnecessary server load, including: - [creating a new Pub/Sub subscription][1], and - [re-requesting all other presences][2] This change updates our presence subscription logic to early return if our desired subscription state already matches both `wantSubscribe` **and** `subscribed`. We also reset `subscribed` to `false` when our connection is disconnected to correctly update our state. [1]: https://github.com/share/sharedb/blob/62e4ec5d46c0dcb097931e9dae60240aaba6b2b3/lib/agent.js#L811 [2]: https://github.com/share/sharedb/blob/62e4ec5d46c0dcb097931e9dae60240aaba6b2b3/lib/agent.js#L820
- Loading branch information
1 parent
62e4ec5
commit 97793c2
Showing
3 changed files
with
33 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters