mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-11-26 15:32:18 +00:00
Go back to job-server per core
This commit is contained in:
parent
b53b34c515
commit
53939f8ae8
10
src/jobs.rs
10
src/jobs.rs
|
@ -46,10 +46,6 @@ pub(crate) fn create_workers(
|
|||
media: MediaCache,
|
||||
config: Config,
|
||||
) -> std::io::Result<JobServer> {
|
||||
let parallelism = std::thread::available_parallelism()
|
||||
.map(usize::from)
|
||||
.unwrap_or(1) as u64;
|
||||
|
||||
let deliver_concurrency = config.deliver_concurrency();
|
||||
|
||||
let queue_handle = WorkerConfig::new(
|
||||
|
@ -76,9 +72,9 @@ pub(crate) fn create_workers(
|
|||
.register::<apub::Forward>()
|
||||
.register::<apub::Reject>()
|
||||
.register::<apub::Undo>()
|
||||
.set_worker_count("maintenance", 2 * parallelism)
|
||||
.set_worker_count("apub", 2 * parallelism)
|
||||
.set_worker_count("deliver", deliver_concurrency * parallelism)
|
||||
.set_worker_count("maintenance", 2)
|
||||
.set_worker_count("apub", 2)
|
||||
.set_worker_count("deliver", deliver_concurrency)
|
||||
.start()?;
|
||||
|
||||
queue_handle.every(Duration::from_secs(60 * 5), Listeners)?;
|
||||
|
|
|
@ -318,8 +318,11 @@ async fn server_main(
|
|||
let bind_address = config.bind_address();
|
||||
let sign_spawner2 = sign_spawner.clone();
|
||||
let verify_spawner2 = verify_spawner.clone();
|
||||
let job_server = create_workers(state.clone(), actors.clone(), media.clone(), config.clone())?;
|
||||
let server = HttpServer::new(move || {
|
||||
let job_server =
|
||||
create_workers(state.clone(), actors.clone(), media.clone(), config.clone())
|
||||
.expect("Failed to create job server");
|
||||
|
||||
let app = App::new()
|
||||
.app_data(web::Data::new(db.clone()))
|
||||
.app_data(web::Data::new(state.clone()))
|
||||
|
@ -328,7 +331,7 @@ async fn server_main(
|
|||
))
|
||||
.app_data(web::Data::new(actors.clone()))
|
||||
.app_data(web::Data::new(config.clone()))
|
||||
.app_data(web::Data::new(job_server.clone()))
|
||||
.app_data(web::Data::new(job_server))
|
||||
.app_data(web::Data::new(media.clone()))
|
||||
.app_data(web::Data::new(collector.clone()))
|
||||
.app_data(web::Data::new(verify_spawner.clone()));
|
||||
|
|
Loading…
Reference in New Issue
Block a user