Skip to content

Commit

Permalink
Remove cargo fmt warning
Browse files Browse the repository at this point in the history
  • Loading branch information
henry42 committed May 20, 2024
1 parent a261169 commit 423fe8a
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ impl Signer {
}

fn renew_if_expired(&self) -> Result<(), Error> {
let mut signature = self.signature.write();

let issued_at = get_time();

#[cfg(feature = "tracing")]
Expand All @@ -189,14 +191,12 @@ impl Signer {
);
}

let mut signature = self.signature.write();

if get_time() - signature.issued_at >= self.expire_after_s.as_secs() as i64 {
if issued_at - signature.issued_at >= self.expire_after_s.as_secs() as i64 {
*signature = Signature {
key: Self::create_signature(&self.secret, &self.key_id, &self.team_id, issued_at)?,
issued_at,
};
}
}

Ok(())
}
Expand Down Expand Up @@ -319,7 +319,6 @@ jDwmlD1Gg0yJt1e38djFwsxsfr5q2hv0Rj9fTEqAPr8H7mGm0wKxZ7iQ
let now = now.clone();
let signer = signer.clone();
threads.push(std::thread::spawn(move || {

let mut sig = String::new();
loop {
let mut sig1 = String::new();
Expand All @@ -334,16 +333,14 @@ jDwmlD1Gg0yJt1e38djFwsxsfr5q2hv0Rj9fTEqAPr8H7mGm0wKxZ7iQ
if now.elapsed() > Duration::from_secs(4) {
break;
}

}

}));
}

for th in threads {
let _ = th.join();
}

assert_eq!(created_sign.lock().unwrap().len() , 2);
assert_eq!(created_sign.lock().unwrap().len(), 2);
}
}

0 comments on commit 423fe8a

Please sign in to comment.