Support very large channel membership lists (#11939)
Fixes the channel membership dialogue for the zed channel by not downloading all 111k people in one go. Release Notes: - N/A
This commit is contained in:
parent
df3bd40c56
commit
57b5bff299
13 changed files with 270 additions and 261 deletions
|
@ -251,7 +251,7 @@ impl Database {
|
|||
.await?;
|
||||
|
||||
let mut is_participant = false;
|
||||
let mut participant_connection_ids = Vec::new();
|
||||
let mut participant_connection_ids = HashSet::default();
|
||||
let mut participant_user_ids = Vec::new();
|
||||
while let Some(row) = rows.next().await {
|
||||
let row = row?;
|
||||
|
@ -259,7 +259,7 @@ impl Database {
|
|||
is_participant = true;
|
||||
}
|
||||
participant_user_ids.push(row.user_id);
|
||||
participant_connection_ids.push(row.connection());
|
||||
participant_connection_ids.insert(row.connection());
|
||||
}
|
||||
drop(rows);
|
||||
|
||||
|
@ -336,13 +336,9 @@ impl Database {
|
|||
}
|
||||
}
|
||||
|
||||
let mut channel_members = self.get_channel_participants(&channel, &tx).await?;
|
||||
channel_members.retain(|member| !participant_user_ids.contains(member));
|
||||
|
||||
Ok(CreatedChannelMessage {
|
||||
message_id,
|
||||
participant_connection_ids,
|
||||
channel_members,
|
||||
notifications,
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue