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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions libs/collab-stream/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ impl CollabRedisStream {
}
}

pub async fn prune_stream(
pub async fn prune_update_stream(
&self,
stream_key: &str,
mut message_id: MessageId,
Expand All @@ -201,11 +201,32 @@ impl CollabRedisStream {
let count = usize::from_redis_value(&value)?;
drop(conn);
tracing::debug!(
"pruned redis stream `{}` <= `{}` ({} objects)",
"pruned redis update stream `{}` <= `{}` ({} objects)",
stream_key,
message_id,
count
);
Ok(count)
}

pub async fn prune_awareness_stream(&self, stream_key: &str) -> Result<(), StreamError> {
let mut conn = self.connection_manager.clone();
let value = conn
.send_packed_command(
redis::cmd("XTRIM")
.arg(stream_key)
.arg("MAXLEN")
.arg("=")
.arg(0),
)
.await?;
let count = usize::from_redis_value(&value)?;
drop(conn);
tracing::debug!(
"pruned redis awareness stream {} ({} objects)",
stream_key,
count
);
Ok(())
}
}
Loading
Loading