mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-26 02:16:30 +00:00
Allow setting the number of runtime workers to be used. (#258)
This change adds a new configuration parameter called `worker_threads` that allows setting the number of workers the Tokio Runtime will use. It defaults to 4 to maintain backward compatibility. Given that the config file parse is done asynchronously, first, a transient runtime is created for reading config, and once it has been parsed, the actual runtime that will be used for PgCat execution is created.
This commit is contained in:
@@ -178,6 +178,9 @@ pub struct General {
|
||||
#[serde(default = "General::default_ban_time")]
|
||||
pub ban_time: i64,
|
||||
|
||||
#[serde(default = "General::default_worker_threads")]
|
||||
pub worker_threads: usize,
|
||||
|
||||
#[serde(default)] // False
|
||||
pub autoreload: bool,
|
||||
|
||||
@@ -219,6 +222,10 @@ impl General {
|
||||
pub fn default_ban_time() -> i64 {
|
||||
60
|
||||
}
|
||||
|
||||
pub fn default_worker_threads() -> usize {
|
||||
4
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for General {
|
||||
@@ -234,6 +241,7 @@ impl Default for General {
|
||||
healthcheck_timeout: Self::default_healthcheck_timeout(),
|
||||
healthcheck_delay: Self::default_healthcheck_delay(),
|
||||
ban_time: Self::default_ban_time(),
|
||||
worker_threads: Self::default_worker_threads(),
|
||||
log_client_connections: false,
|
||||
log_client_disconnections: false,
|
||||
autoreload: false,
|
||||
|
||||
Reference in New Issue
Block a user