Skip to content

fix/avoid race condition by preserving room until no connection #26

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

Merged
merged 3 commits into from
Jan 25, 2025

Conversation

stanley2058
Copy link
Collaborator

Manual deleting streams would lead to race conditions in a distributed architecture. This PR changed to use Redis TTL for removing inactive streams instead of manual operation.

src/api.js Outdated
}
await this.redis.multi()
.xTrim(roomName, 'MINID', lastId - this.redisMinMessageLifetime)
.xDelIfEmpty(roomName)
Copy link
Member

@jackycute jackycute Jan 25, 2025

Choose a reason for hiding this comment

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

maybe not remove stream even the room messages is empty to avoid race?

@jackycute jackycute requested a review from Yukaii January 25, 2025 08:15
@jackycute jackycute merged commit 0b51b65 into main Jan 25, 2025
1 check passed
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