Skip to content

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