mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-26 10:40:54 +00:00
Avoid sending a GetUsers request for an emptly list of user ids
We don't actually need to return the users at this time. We just call this for its side effect. Co-authored-by: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
b8aba0972d
commit
45b6a9df36
1 changed files with 10 additions and 2 deletions
|
@ -376,9 +376,17 @@ impl UserStore {
|
||||||
&mut self,
|
&mut self,
|
||||||
mut user_ids: Vec<u64>,
|
mut user_ids: Vec<u64>,
|
||||||
cx: &mut ModelContext<Self>,
|
cx: &mut ModelContext<Self>,
|
||||||
) -> Task<Result<Vec<Arc<User>>>> {
|
) -> Task<Result<()>> {
|
||||||
user_ids.retain(|id| !self.users.contains_key(id));
|
user_ids.retain(|id| !self.users.contains_key(id));
|
||||||
self.load_users(proto::GetUsers { user_ids }, cx)
|
if user_ids.is_empty() {
|
||||||
|
Task::ready(Ok(()))
|
||||||
|
} else {
|
||||||
|
let load = self.load_users(proto::GetUsers { user_ids }, cx);
|
||||||
|
cx.foreground().spawn(async move {
|
||||||
|
load.await?;
|
||||||
|
Ok(())
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn fuzzy_search_users(
|
pub fn fuzzy_search_users(
|
||||||
|
|
Loading…
Reference in a new issue