Skip to content

Commit

Permalink
Fix display after setting relay manually
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedilger committed Oct 27, 2023
1 parent adc1619 commit cdcd23f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions gossip-lib/src/overlord/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,13 @@ impl Overlord {
pr.manually_paired_write = true;
GLOBALS.storage.write_person_relay(&pr, None)?;

if let Some(pk) = GLOBALS.people.get_active_person_async().await {
if pk == pubkey {
// Refresh active person data from storage
GLOBALS.people.set_active_person(pubkey).await?;
}
}

self.pick_relays().await;

Ok(())
Expand Down
4 changes: 4 additions & 0 deletions gossip-lib/src/people.rs
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,10 @@ impl People {
*self.active_person.blocking_read()
}

pub async fn get_active_person_async(&self) -> Option<PublicKey> {
*self.active_person.read().await
}

pub fn get_active_person_write_relays(&self) -> Vec<(RelayUrl, u64)> {
self.active_persons_write_relays.blocking_read().clone()
}
Expand Down

0 comments on commit cdcd23f

Please sign in to comment.