Change parameters to reduce CPU usage growth and reduce message spam

This commit is contained in:
Condorra 2023-01-28 18:34:32 +11:00
parent a3ea381438
commit 737fe3a86f
4 changed files with 9 additions and 5 deletions

View File

@ -7,3 +7,7 @@ members = [
"ansi_macro", "ansi_macro",
"ansi", "ansi",
] ]
[profile.release-with-debug]
inherits = "release"
debug = true

View File

@ -31,7 +31,7 @@ fn read_latest_config() -> DResult<Config> {
map_err(|error| Box::new(error) as Box<dyn Error + Send + Sync>) map_err(|error| Box::new(error) as Box<dyn Error + Send + Sync>)
} }
#[tokio::main] #[tokio::main(worker_threads = 2)]
async fn main() -> DResult<()> { async fn main() -> DResult<()> {
SimpleLogger::new().with_level(LevelFilter::Info).init().unwrap(); SimpleLogger::new().with_level(LevelFilter::Info).init().unwrap();

View File

@ -197,8 +197,8 @@ pub fn npc_wander_tasks() -> Box<dyn Iterator<Item = StaticTask>> {
meta: TaskMeta { meta: TaskMeta {
task_code: c.code.to_owned(), task_code: c.code.to_owned(),
is_static: true, is_static: true,
recurrence: Some(TaskRecurrence::FixedDuration { seconds: rng.gen_range(100..150) as u32 }), recurrence: Some(TaskRecurrence::FixedDuration { seconds: rng.gen_range(250..350) as u32 }),
next_scheduled: Utc::now() + chrono::Duration::seconds(rng.gen_range(0..30) as i64), next_scheduled: Utc::now() + chrono::Duration::seconds(rng.gen_range(0..300) as i64),
..TaskMeta::default() ..TaskMeta::default()
}, },
details: TaskDetails::NPCWander { details: TaskDetails::NPCWander {
@ -216,7 +216,7 @@ pub fn npc_aggro_tasks() -> Box<dyn Iterator<Item = StaticTask>> {
initial_task: Box::new( initial_task: Box::new(
|| { || {
let mut rng = thread_rng(); let mut rng = thread_rng();
let aggro_time = (rng.gen_range(100..150) as u64) / c.aggression; let aggro_time = (rng.gen_range(450..550) as u64) / c.aggression;
Task { Task {
meta: TaskMeta { meta: TaskMeta {
task_code: c.code.to_owned(), task_code: c.code.to_owned(),

View File

@ -5,7 +5,7 @@ pub fn npc_list() -> Vec<NPC> {
use NPCSayType::FromFixedList; use NPCSayType::FromFixedList;
let melbs_citizen_stdsay = NPCSayInfo { let melbs_citizen_stdsay = NPCSayInfo {
say_code: "babble", say_code: "babble",
frequency_secs: 60, frequency_secs: 120,
talk_type: FromFixedList(vec!( talk_type: FromFixedList(vec!(
(false, "I'm so sick of being cloned."), (false, "I'm so sick of being cloned."),
(false, "I hope I don't die again today."), (false, "I hope I don't die again today."),