diff --git a/src/worker/base.rs b/src/worker/base.rs index 72bf738..1cc569f 100644 --- a/src/worker/base.rs +++ b/src/worker/base.rs @@ -117,7 +117,7 @@ impl BaseWorker { // beim Debuggen selten. Deshalb nur loggen, wenn der Worker // sich nicht im Idle-Zustand befindet. if !step.ends_with(" idle") { - eprintln!("[{name}] Watchdog: current step = {step}"); + // keine Info-Logs im Watchdog } } })); diff --git a/src/worker/director.rs b/src/worker/director.rs index da61ed1..dd4fc51 100644 --- a/src/worker/director.rs +++ b/src/worker/director.rs @@ -153,7 +153,7 @@ impl DirectorWorker { .collect(); if directors.is_empty() { - eprintln!("[DirectorWorker] Keine Direktoren für Aktionen gefunden (Zeitfenster oder DB-Daten)."); + // keine Info-Logs } for director in directors { diff --git a/src/worker/produce.rs b/src/worker/produce.rs index 0b9aa6e..16c8d24 100644 --- a/src/worker/produce.rs +++ b/src/worker/produce.rs @@ -126,14 +126,7 @@ impl ProduceWorker { self.base .set_current_step("Process Finished Productions"); - if finished_productions.is_empty() { - eprintln!("[ProduceWorker] Keine abgeschlossenen Produktionen gefunden."); - } else { - eprintln!( - "[ProduceWorker] Verarbeite {} abgeschlossene Produktionen.", - finished_productions.len() - ); - } + // Nur Fehler loggen; keine Debug-Infos for production in finished_productions { self.handle_finished_production(&production); @@ -182,15 +175,7 @@ impl ProduceWorker { } }; - if stocks.is_empty() { - eprintln!("[ProduceWorker] Keine Stocks für Branch {branch_id} gefunden."); - } else { - eprintln!( - "[ProduceWorker] {} Stocks gefunden für Branch {}.", - stocks.len(), - branch_id - ); - } + // Ruhemodus: keine Info-Logs, nur Fehler for stock in stocks { if remaining_quantity <= 0 { @@ -198,35 +183,18 @@ impl ProduceWorker { } let free_capacity = stock.total_capacity - stock.filled; - eprintln!( - "[ProduceWorker] Stock {}: capacity={}, filled={}, free={}", - stock.stock_id, - stock.total_capacity, - stock.filled, - free_capacity - ); + // keine Debug-Ausgabe if free_capacity <= 0 { continue; } let to_store = min(remaining_quantity, free_capacity); - eprintln!( - "[ProduceWorker] Versuche Einlagerung: stock={}, product={}, qty={}, quality={}", - stock.stock_id, - product_id, - to_store, - quality - ); + // keine Debug-Ausgabe if !self.store_in_stock(stock.stock_id, product_id, to_store, quality) { return false; } remaining_quantity -= to_store; - eprintln!( - "[ProduceWorker] Eingelagert: stock={}, qty={} (remaining={})", - stock.stock_id, - to_store, - remaining_quantity - ); + // keine Debug-Ausgabe } if remaining_quantity == 0 { @@ -358,12 +326,7 @@ impl ProduceWorker { .map_err(|e| crate::db::DbError::new(format!("DB-Verbindung fehlgeschlagen: {e}")))?; conn.prepare("insert_inventory", QUERY_INSERT_INVENTORY)?; - let rows = conn.execute("insert_inventory", &[&stock_id, &product_id, &quantity, &quality])?; - if let Some(row) = rows.get(0) { - if let Some(id) = row.get("id") { - eprintln!("[ProduceWorker] Insert inventory id={}", id); - } - } + let _rows = conn.execute("insert_inventory", &[&stock_id, &product_id, &quantity, &quality])?; Ok(()) } diff --git a/src/worker/transport.rs b/src/worker/transport.rs index e5c0603..291dbab 100644 --- a/src/worker/transport.rs +++ b/src/worker/transport.rs @@ -12,7 +12,6 @@ use crate::worker::sql::{ QUERY_INSERT_INVENTORY, QUERY_UPDATE_VEHICLE_AFTER_TRANSPORT, QUERY_DELETE_TRANSPORT, - QUERY_ADD_TRANSPORT_WAITING_NOTIFICATION, QUERY_GET_BRANCH_REGION, QUERY_UPDATE_TRANSPORT_SIZE, }; @@ -141,10 +140,7 @@ impl TransportWorker { // Leere Transporte (ohne Produkt) werden anders behandelt if t.product_id.is_none() { // Leerer Transport: Nur Fahrzeug-Region aktualisieren und Transport löschen - eprintln!( - "[TransportWorker] Leerer Transport {} angekommen: Fahrzeug {} zurückgeholt", - t.id, t.vehicle_id - ); + // keine Info-Logs Self::update_vehicle_after_transport(pool, t.vehicle_id, t.target_branch_id, t.distance)?; Self::delete_transport(pool, t.id)?; @@ -229,18 +225,7 @@ impl TransportWorker { } } - // Nutzer informieren, dass Ware noch im Transportmittel liegt. - if t.user_id > 0 && let Err(err) = Self::insert_transport_waiting_notification( - pool, - t.user_id, - product_id, - remaining_quantity, - ) - { - eprintln!( - "[TransportWorker] Fehler beim Schreiben der Transport-Waiting-Notification: {err}" - ); - } + // Keine Notification für wartende Transporte, um Notification-System zu entlasten. } Ok(()) @@ -394,33 +379,6 @@ impl TransportWorker { Ok(()) } - fn insert_transport_waiting_notification( - pool: &ConnectionPool, - user_id: i32, - product_id: i32, - remaining_quantity: i32, - ) -> Result<(), DbError> { - let mut conn = pool - .get() - .map_err(|e| DbError::new(format!("DB-Verbindung fehlgeschlagen: {e}")))?; - - conn.prepare( - "add_transport_waiting_notification", - QUERY_ADD_TRANSPORT_WAITING_NOTIFICATION, - )?; - - let notification = format!( - r#"{{"tr":"transport.waiting","productId":{},"value":{}}}"#, - product_id, remaining_quantity - ); - - conn.execute( - "add_transport_waiting_notification", - &[&user_id, ¬ification], - )?; - - Ok(()) - } } impl Worker for TransportWorker {