mirror of
https://git.asonix.dog/asonix/relay.git
synced 2024-11-25 11:01:11 +00:00
Go back to job-server per core
This commit is contained in:
parent
b53b34c515
commit
53939f8ae8
2 changed files with 8 additions and 9 deletions
10
src/jobs.rs
10
src/jobs.rs
|
@ -46,10 +46,6 @@ pub(crate) fn create_workers(
|
||||||
media: MediaCache,
|
media: MediaCache,
|
||||||
config: Config,
|
config: Config,
|
||||||
) -> std::io::Result<JobServer> {
|
) -> 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 deliver_concurrency = config.deliver_concurrency();
|
||||||
|
|
||||||
let queue_handle = WorkerConfig::new(
|
let queue_handle = WorkerConfig::new(
|
||||||
|
@ -76,9 +72,9 @@ pub(crate) fn create_workers(
|
||||||
.register::<apub::Forward>()
|
.register::<apub::Forward>()
|
||||||
.register::<apub::Reject>()
|
.register::<apub::Reject>()
|
||||||
.register::<apub::Undo>()
|
.register::<apub::Undo>()
|
||||||
.set_worker_count("maintenance", 2 * parallelism)
|
.set_worker_count("maintenance", 2)
|
||||||
.set_worker_count("apub", 2 * parallelism)
|
.set_worker_count("apub", 2)
|
||||||
.set_worker_count("deliver", deliver_concurrency * parallelism)
|
.set_worker_count("deliver", deliver_concurrency)
|
||||||
.start()?;
|
.start()?;
|
||||||
|
|
||||||
queue_handle.every(Duration::from_secs(60 * 5), Listeners)?;
|
queue_handle.every(Duration::from_secs(60 * 5), Listeners)?;
|
||||||
|
|
|
@ -318,8 +318,11 @@ async fn server_main(
|
||||||
let bind_address = config.bind_address();
|
let bind_address = config.bind_address();
|
||||||
let sign_spawner2 = sign_spawner.clone();
|
let sign_spawner2 = sign_spawner.clone();
|
||||||
let verify_spawner2 = verify_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 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()
|
let app = App::new()
|
||||||
.app_data(web::Data::new(db.clone()))
|
.app_data(web::Data::new(db.clone()))
|
||||||
.app_data(web::Data::new(state.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(actors.clone()))
|
||||||
.app_data(web::Data::new(config.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(media.clone()))
|
||||||
.app_data(web::Data::new(collector.clone()))
|
.app_data(web::Data::new(collector.clone()))
|
||||||
.app_data(web::Data::new(verify_spawner.clone()));
|
.app_data(web::Data::new(verify_spawner.clone()));
|
||||||
|
|
Loading…
Reference in a new issue