Add EventsWorker to worker module: Introduced EventsWorker for handling event-related tasks. Updated main.rs to include EventsWorker in the worker creation process. Adjusted WeatherWorker instantiation to use cloned pool and broker for consistency.

This commit is contained in:
Torsten Schulz (local)
2025-12-08 11:17:16 +01:00
parent 8db82e0ced
commit 5a3a818d84
4 changed files with 1818 additions and 5 deletions

View File

@@ -13,9 +13,9 @@ use libsystemd::daemon::{self, NotifyState};
use message_broker::MessageBroker;
use websocket_server::WebSocketServer;
use worker::{
CharacterCreationWorker, ConnectionPool, DirectorWorker, HouseWorker, PoliticsWorker,
ProduceWorker, StockageManager, TransportWorker, UndergroundWorker, UserCharacterWorker,
ValueRecalculationWorker, WeatherWorker, Worker,
CharacterCreationWorker, ConnectionPool, DirectorWorker, EventsWorker, HouseWorker,
PoliticsWorker, ProduceWorker, StockageManager, TransportWorker, UndergroundWorker,
UserCharacterWorker, ValueRecalculationWorker, WeatherWorker, Worker,
};
static KEEP_RUNNING: AtomicBool = AtomicBool::new(true);
@@ -141,7 +141,8 @@ fn create_workers(pool: ConnectionPool, broker: MessageBroker) -> Vec<Box<dyn Wo
Box::new(PoliticsWorker::new(pool.clone(), broker.clone())),
Box::new(TransportWorker::new(pool.clone(), broker.clone())),
Box::new(UndergroundWorker::new(pool.clone(), broker.clone())),
Box::new(WeatherWorker::new(pool, broker)),
Box::new(WeatherWorker::new(pool.clone(), broker.clone())),
Box::new(EventsWorker::new(pool, broker)),
]
}

1810
src/worker/events.rs Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -10,6 +10,7 @@ mod value_recalculation;
mod user_character;
mod transport;
mod weather;
mod events;
pub use base::Worker;
pub use crate::db::ConnectionPool;
@@ -24,4 +25,5 @@ pub use value_recalculation::ValueRecalculationWorker;
pub use user_character::UserCharacterWorker;
pub use transport::TransportWorker;
pub use weather::WeatherWorker;
pub use events::EventsWorker;

View File

@@ -290,7 +290,7 @@ const QUERY_GET_PREGNANCY_CANDIDATES: &str = r#"
+ (CURRENT_DATE - c2.birthdate::date)) / 2
) - 2.638267
))
) / 2;
);
"#;
const QUERY_INSERT_CHILD: &str = r#"