fix: remove panics and unblock flows
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
mod profile;
|
||||
|
||||
use gpui::{App, AppContext};
|
||||
pub use profile::{Profile, ProfileDirectory, ProfileEvent, ProfileStore};
|
||||
pub use profile::{Profile, ProfileDirectory, ProfileStore};
|
||||
|
||||
/// Initialize the global profile store.
|
||||
pub fn init(cx: &mut App) {
|
||||
|
||||
@@ -320,6 +320,7 @@ impl ProfileDirectory {
|
||||
Ok::<_, anyhow::Error>(Profile::latest_profiles(events))
|
||||
});
|
||||
|
||||
self.tasks.retain(|task| !task.is_ready());
|
||||
self.tasks.push(cx.spawn(async move |this, cx| {
|
||||
let loaded = work.await;
|
||||
|
||||
@@ -335,6 +336,12 @@ impl ProfileDirectory {
|
||||
}
|
||||
Err(e) => {
|
||||
log::warn!("failed to load profiles from the database: {e}");
|
||||
// A failed query must not pin these keys forever.
|
||||
this.with_pending(|pending| {
|
||||
for key in &keys {
|
||||
pending.remove(key);
|
||||
}
|
||||
});
|
||||
keys
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user