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

fix: trim awareness when collab group is dropped #1163

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

khorshuheng
Copy link
Collaborator

@khorshuheng khorshuheng commented Jan 14, 2025

Trim awareness when collab group is dropped, as there is no need to persist awareness when no users are connected. If we don't trim the awareness, when the server is restarted, all the awareness info will be read from the stream again. In addition, the size of the awareness stream will also be much more than necessary (reaching the maximum, which is 100).

This does introduce some complication for having multiple replica of AppFlowy Cloud, however, if the same collab can have collab group in two different replica. When that happen, we may have to store some information on Redis to determine whether it is safe to trim the stream. Or, alternatively, we can periodically set TTL to the Redis stream key when a Collab Group is active. If none of the groups are active in any of the replica, the key will automatically be dropped.

Also removed the minimum timeout as a criteria for removing CollabGroup - there's no reason to keep collab group when the number of subscriber reach zero.

@khorshuheng khorshuheng marked this pull request as draft January 14, 2025 08:07
@khorshuheng khorshuheng force-pushed the trim-awareness-on-drop branch from 840dce8 to 8c6a657 Compare January 14, 2025 16:56
@khorshuheng khorshuheng marked this pull request as ready for review January 14, 2025 16:56
@khorshuheng khorshuheng requested a review from appflowy January 14, 2025 16:57
@khorshuheng khorshuheng changed the title Draft:fix: trim awareness when collab group is dropped fix: trim awareness when collab group is dropped Jan 14, 2025
@khorshuheng
Copy link
Collaborator Author

@Horusiath FYI

@khorshuheng khorshuheng merged commit c3bba77 into main Jan 15, 2025
10 of 11 checks passed
@khorshuheng khorshuheng deleted the trim-awareness-on-drop branch January 15, 2025 03:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants