mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-11-22 01:21:06 +00:00
use stable async-cpupool
This commit is contained in:
parent
4383357abe
commit
e4f665d75f
4 changed files with 8 additions and 8 deletions
3
Cargo.lock
generated
3
Cargo.lock
generated
|
@ -467,7 +467,8 @@ checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6"
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "async-cpupool"
|
name = "async-cpupool"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
source = "git+https://git.asonix.dog/safe-async/async-cpupool#2884d854fff83e96ad70b8dc06e947377d53e1b7"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ba06506d5e5f2e45254bfb3175d5ca14b7dbb817cf0651cc2cc3a8b18a12c5a5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"flume",
|
"flume",
|
||||||
"metrics",
|
"metrics",
|
||||||
|
|
|
@ -28,7 +28,7 @@ actix-webfinger = { version = "0.5.0", default-features = false }
|
||||||
activitystreams = "0.7.0-alpha.25"
|
activitystreams = "0.7.0-alpha.25"
|
||||||
activitystreams-ext = "0.1.0-alpha.3"
|
activitystreams-ext = "0.1.0-alpha.3"
|
||||||
ammonia = "3.1.0"
|
ammonia = "3.1.0"
|
||||||
async-cpupool = { version = "0.1.0", git = "https://git.asonix.dog/safe-async/async-cpupool" }
|
async-cpupool = "0.1.0"
|
||||||
bcrypt = "0.15"
|
bcrypt = "0.15"
|
||||||
base64 = "0.21"
|
base64 = "0.21"
|
||||||
clap = { version = "4.0.0", features = ["derive"] }
|
clap = { version = "4.0.0", features = ["derive"] }
|
||||||
|
|
|
@ -311,8 +311,8 @@ async fn do_server_main(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let verify_spawner = Spawner::build("verify-cpu", verify_threads.try_into()?);
|
let verify_spawner = Spawner::build("verify-cpu", verify_threads.try_into()?)?;
|
||||||
let sign_spawner = Spawner::build("sign-cpu", signature_threads.try_into()?);
|
let sign_spawner = Spawner::build("sign-cpu", signature_threads.try_into()?)?;
|
||||||
|
|
||||||
let key_id = config.generate_url(UrlKind::MainKey).to_string();
|
let key_id = config.generate_url(UrlKind::MainKey).to_string();
|
||||||
let state = State::build(db.clone(), key_id, sign_spawner.clone(), client).await?;
|
let state = State::build(db.clone(), key_id, sign_spawner.clone(), client).await?;
|
||||||
|
|
|
@ -8,14 +8,13 @@ pub(crate) struct Spawner {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Spawner {
|
impl Spawner {
|
||||||
pub(crate) fn build(name: &'static str, threads: u16) -> Self {
|
pub(crate) fn build(name: &'static str, threads: u16) -> anyhow::Result<Self> {
|
||||||
let pool = CpuPool::configure()
|
let pool = CpuPool::configure()
|
||||||
.name(name)
|
.name(name)
|
||||||
.max_threads(threads)
|
.max_threads(threads)
|
||||||
.build()
|
.build()?;
|
||||||
.expect("valid configuration");
|
|
||||||
|
|
||||||
Spawner { pool }
|
Ok(Spawner { pool })
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) async fn close(self) {
|
pub(crate) async fn close(self) {
|
||||||
|
|
Loading…
Reference in a new issue