Skip to content

Commit eaba581

Browse files
committed
feat: change default max_concurrent_tasks from 8 to 6, support CONCURRENTLY_TASKS env var
- Default concurrent tasks changed from 8 to 6 - Supports both CONCURRENTLY_TASKS and MAX_CONCURRENT_TASKS env vars - CONCURRENTLY_TASKS takes precedence if set
1 parent 54b775c commit eaba581

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/config.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::path::PathBuf;
22

33
const DEFAULT_PORT: u16 = 8080;
44
const DEFAULT_SESSION_TTL: u64 = 7200;
5-
const DEFAULT_MAX_CONCURRENT: usize = 8;
5+
const DEFAULT_MAX_CONCURRENT: usize = 6;
66
const DEFAULT_CLONE_TIMEOUT: u64 = 600;
77
const DEFAULT_AGENT_TIMEOUT: u64 = 600;
88
const DEFAULT_TEST_TIMEOUT: u64 = 300;
@@ -50,7 +50,10 @@ impl Config {
5050
Ok(Self {
5151
port: env_parse("PORT", DEFAULT_PORT),
5252
session_ttl_secs: env_parse("SESSION_TTL_SECS", DEFAULT_SESSION_TTL),
53-
max_concurrent_tasks: env_parse("MAX_CONCURRENT_TASKS", DEFAULT_MAX_CONCURRENT),
53+
max_concurrent_tasks: std::env::var("CONCURRENTLY_TASKS")
54+
.ok()
55+
.and_then(|v| v.parse().ok())
56+
.unwrap_or_else(|| env_parse("MAX_CONCURRENT_TASKS", DEFAULT_MAX_CONCURRENT)),
5457
clone_timeout_secs: env_parse("CLONE_TIMEOUT_SECS", DEFAULT_CLONE_TIMEOUT),
5558
agent_timeout_secs: env_parse("AGENT_TIMEOUT_SECS", DEFAULT_AGENT_TIMEOUT),
5659
test_timeout_secs: env_parse("TEST_TIMEOUT_SECS", DEFAULT_TEST_TIMEOUT),
@@ -136,7 +139,7 @@ mod tests {
136139
let _lock = ENV_LOCK.lock().unwrap();
137140
let cfg = Config::from_env().expect("default config should be valid");
138141
assert_eq!(cfg.port, DEFAULT_PORT);
139-
assert_eq!(cfg.max_concurrent_tasks, DEFAULT_MAX_CONCURRENT);
142+
assert_eq!(cfg.max_concurrent_tasks, 6);
140143
assert_eq!(cfg.bittensor_netuid, 100);
141144
assert!((cfg.consensus_threshold - 0.5).abs() < f64::EPSILON);
142145
}

0 commit comments

Comments
 (0)