forked from mirrors/relay
Don't precompute, it already happens
This commit is contained in:
parent
45349f3252
commit
1e8c54f7cc
2 changed files with 6 additions and 8 deletions
|
@ -171,13 +171,7 @@ impl State {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let (blocks, whitelists, listeners, mut private_key) = try_join!(f1, f2, f3, f4)?;
|
let (blocks, whitelists, listeners, private_key) = try_join!(f1, f2, f3, f4)?;
|
||||||
|
|
||||||
let private_key: RSAPrivateKey = web::block(move || {
|
|
||||||
private_key.precompute();
|
|
||||||
Ok(private_key) as Result<_, std::convert::Infallible>
|
|
||||||
})
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
let public_key = private_key.to_public_key();
|
let public_key = private_key.to_public_key();
|
||||||
let listeners = Arc::new(RwLock::new(listeners));
|
let listeners = Arc::new(RwLock::new(listeners));
|
||||||
|
|
|
@ -152,7 +152,11 @@ impl Db {
|
||||||
|
|
||||||
if let Some(row) = rows.into_iter().next() {
|
if let Some(row) = rows.into_iter().next() {
|
||||||
let key_str: String = row.get(0);
|
let key_str: String = row.get(0);
|
||||||
return Ok(Some(KeyExt::from_pem_pkcs8(&key_str)?));
|
// precomputation happens when constructing a private key, so it should be on the
|
||||||
|
// threadpool
|
||||||
|
let key = actix_web::web::block(move || KeyExt::from_pem_pkcs8(&key_str)).await?;
|
||||||
|
|
||||||
|
return Ok(Some(key));
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(None)
|
Ok(None)
|
||||||
|
|
Loading…
Reference in a new issue