Skip to content

Commit

Permalink
Merge branch 'main' into feat/shuttle-gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusc93 committed Oct 11, 2023
2 parents e0b49ee + c537ce1 commit 773d691
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions extensions/warp-ipfs/src/store/identity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,6 @@ pub struct IdentityStore {

phonebook: PhoneBook,

wait_on_response: Option<Duration>,

signal: Arc<RwLock<HashMap<DID, oneshot::Sender<Result<(), Error>>>>>,

discovery: Discovery,
Expand Down Expand Up @@ -313,7 +311,6 @@ impl IdentityStore {
let phonebook = PhoneBook::new(discovery.clone(), pb_tx);

let signal = Default::default();
let wait_on_response = config.store_setting.friend_request_response_duration;

let store = Self {
ipfs,
Expand All @@ -330,7 +327,6 @@ impl IdentityStore {
queue,
phonebook,
signal,
wait_on_response,
};

if let Ok(ident) = store.own_identity().await {
Expand Down Expand Up @@ -2526,7 +2522,11 @@ impl IdentityStore {

let mut queued = false;

let wait = self.wait_on_response.is_some();
let wait = self
.config
.store_setting
.friend_request_response_duration
.is_some();

let mut rx = (matches!(payload.event, Event::Request) && wait).then_some({
let (tx, rx) = oneshot::channel();
Expand Down Expand Up @@ -2556,7 +2556,7 @@ impl IdentityStore {

if !queued && matches!(payload.event, Event::Request) {
if let Some(rx) = std::mem::take(&mut rx) {
if let Some(timeout) = self.wait_on_response {
if let Some(timeout) = self.config.store_setting.friend_request_response_duration {
let start = Instant::now();
if let Ok(Ok(res)) = tokio::time::timeout(timeout, rx).await {
let end = start.elapsed();
Expand Down

0 comments on commit 773d691

Please sign in to comment.