mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-30 00:41:42 +00:00
Fix the "I cannot find you" issue by asynchronously creating
This commit is contained in:
parent
b96cd1fb5a
commit
d5d1f2fee3
@ -165,6 +165,14 @@ impl People {
|
||||
output
|
||||
}
|
||||
|
||||
pub fn create_if_missing_sync(&self, pubkey: PublicKeyHex) {
|
||||
task::spawn(async {
|
||||
if let Err(e) = GLOBALS.people.create_all_if_missing(&[pubkey]).await {
|
||||
tracing::error!("{}", e);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
pub async fn create_all_if_missing(&self, pubkeys: &[PublicKeyHex]) -> Result<(), Error> {
|
||||
// Collect the public keys that we don't have already (by checking in memory).
|
||||
let pubkeys: Vec<&PublicKeyHex> = pubkeys
|
||||
|
@ -32,6 +32,7 @@ pub(super) fn update(app: &mut GossipUi, _ctx: &Context, _frame: &mut eframe::Fr
|
||||
Some(dbp) => dbp,
|
||||
None => {
|
||||
ui.label("I cannot find you.");
|
||||
GLOBALS.people.create_if_missing_sync(public_key.into());
|
||||
return;
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user