Set worker count 0 in debug mode
This commit is contained in:
parent
58c9ea12ad
commit
d7e401eeed
3 changed files with 12 additions and 11 deletions
|
@ -39,10 +39,7 @@ pub struct Instance {
|
||||||
|
|
||||||
impl Instance {
|
impl Instance {
|
||||||
pub fn new(hostname: String) -> Result<InstanceHandle, Error> {
|
pub fn new(hostname: String) -> Result<InstanceHandle, Error> {
|
||||||
let settings = InstanceSettingsBuilder::default()
|
let settings = InstanceSettingsBuilder::default().debug(true).build()?;
|
||||||
.debug(true)
|
|
||||||
.worker_count(1)
|
|
||||||
.build()?;
|
|
||||||
let local_instance =
|
let local_instance =
|
||||||
LocalInstance::new(hostname.clone(), Client::default().into(), settings);
|
LocalInstance::new(hostname.clone(), Client::default().into(), settings);
|
||||||
let local_user = MyUser::new(generate_object_id(&hostname)?, generate_actor_keypair()?);
|
let local_user = MyUser::new(generate_object_id(&hostname)?, generate_actor_keypair()?);
|
||||||
|
|
|
@ -2,6 +2,7 @@ use crate::{
|
||||||
core::signatures::{sign_request, PublicKey},
|
core::signatures::{sign_request, PublicKey},
|
||||||
utils::verify_url_valid,
|
utils::verify_url_valid,
|
||||||
Error,
|
Error,
|
||||||
|
InstanceSettings,
|
||||||
LocalInstance,
|
LocalInstance,
|
||||||
APUB_JSON_CONTENT_TYPE,
|
APUB_JSON_CONTENT_TYPE,
|
||||||
};
|
};
|
||||||
|
@ -181,9 +182,16 @@ fn generate_request_headers(inbox_url: &Url) -> HeaderMap {
|
||||||
|
|
||||||
pub(crate) fn create_activity_queue(
|
pub(crate) fn create_activity_queue(
|
||||||
client: ClientWithMiddleware,
|
client: ClientWithMiddleware,
|
||||||
worker_count: u64,
|
settings: &InstanceSettings,
|
||||||
timeout: Duration,
|
|
||||||
) -> Manager {
|
) -> Manager {
|
||||||
|
// queue is not used in debug mod, so dont create any workers to avoid log spam
|
||||||
|
let worker_count = if settings.debug {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
settings.worker_count
|
||||||
|
};
|
||||||
|
let timeout = settings.request_timeout;
|
||||||
|
|
||||||
// Configure and start our workers
|
// Configure and start our workers
|
||||||
WorkerConfig::new_managed(Storage::new(), move |_| MyState {
|
WorkerConfig::new_managed(Storage::new(), move |_| MyState {
|
||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
|
|
|
@ -51,11 +51,7 @@ pub struct InstanceSettings {
|
||||||
|
|
||||||
impl LocalInstance {
|
impl LocalInstance {
|
||||||
pub fn new(domain: String, client: ClientWithMiddleware, settings: InstanceSettings) -> Self {
|
pub fn new(domain: String, client: ClientWithMiddleware, settings: InstanceSettings) -> Self {
|
||||||
let activity_queue = create_activity_queue(
|
let activity_queue = create_activity_queue(client.clone(), &settings);
|
||||||
client.clone(),
|
|
||||||
settings.worker_count,
|
|
||||||
settings.request_timeout,
|
|
||||||
);
|
|
||||||
LocalInstance {
|
LocalInstance {
|
||||||
hostname: domain,
|
hostname: domain,
|
||||||
client,
|
client,
|
||||||
|
|
Loading…
Reference in a new issue