Browse Source

Fix log flood: "State is FINISH but completion NOT triggered" (#790)

  Diagnostic log added in 0.2.2.1 fired on every MQTT update while a
  printer was in FINISH/FAILED state, not just on the state transition.
  For farms with multiple idle printers, this produced thousands of log
  lines per minute. Guard the log to only fire once when the state first
  changes to FINISH/FAILED.
maziggy 2 months ago
parent
commit
745ff232eb
2 changed files with 8 additions and 2 deletions
  1. 1 0
      CHANGELOG.md
  2. 7 2
      backend/app/services/bambu_mqtt.py

+ 1 - 0
CHANGELOG.md

@@ -12,6 +12,7 @@ All notable changes to Bambuddy will be documented in this file.
 - **SpoolBuddy Update UI Stale After Restart** — After a SpoolBuddy update, the UI permanently showed the old version and "update available" because: (1) the SSH update set status to `"complete"` after the daemon had already re-registered, overwriting the cleared state; (2) the kiosk restart navigated away from the updates page; (3) query cache served stale data. Fixed by letting daemon re-registration clear all update status, removing the kiosk restart in favor of a frontend-driven `window.location.reload()` triggered via WebSocket when the daemon comes back online, and adding proper loading states to Check/Force Update buttons.
 - **SpoolBuddy Update UI Stale After Restart** — After a SpoolBuddy update, the UI permanently showed the old version and "update available" because: (1) the SSH update set status to `"complete"` after the daemon had already re-registered, overwriting the cleared state; (2) the kiosk restart navigated away from the updates page; (3) query cache served stale data. Fixed by letting daemon re-registration clear all update status, removing the kiosk restart in favor of a frontend-driven `window.location.reload()` triggered via WebSocket when the daemon comes back online, and adding proper loading states to Check/Force Update buttons.
 - **Virtual Printer Proxy A1 Printing Fails** ([#757](https://github.com/maziggy/bambuddy/issues/757)) — BambuStudio could not send prints to A1 (and potentially P1S) virtual printers in proxy mode. The slicer connects to undocumented proprietary ports 2024-2026 on these models, which the proxy was not forwarding, causing BambuStudio to show an access code dialog instead of printing. Added transparent TCP pass-through proxying for ports 2024-2026. These ports are silently ignored on models that don't use them (X1C, H2C, P2S). Reported by @Utility9298.
 - **Virtual Printer Proxy A1 Printing Fails** ([#757](https://github.com/maziggy/bambuddy/issues/757)) — BambuStudio could not send prints to A1 (and potentially P1S) virtual printers in proxy mode. The slicer connects to undocumented proprietary ports 2024-2026 on these models, which the proxy was not forwarding, causing BambuStudio to show an access code dialog instead of printing. Added transparent TCP pass-through proxying for ports 2024-2026. These ports are silently ignored on models that don't use them (X1C, H2C, P2S). Reported by @Utility9298.
 - **Spool Assignment on Empty AMS Slots** ([#784](https://github.com/maziggy/bambuddy/issues/784)) — Empty AMS slots (no physical spool detected) showed "Assign Spool" and "Configure" buttons in the hover popup. Assigning a spool to an empty slot created a stuck state because no "Unassign" button is available for empty slots. Removed both buttons from empty AMS and HT AMS slot popups. External spool holders are unaffected. Reported by @RosdasHH.
 - **Spool Assignment on Empty AMS Slots** ([#784](https://github.com/maziggy/bambuddy/issues/784)) — Empty AMS slots (no physical spool detected) showed "Assign Spool" and "Configure" buttons in the hover popup. Assigning a spool to an empty slot created a stuck state because no "Unassign" button is available for empty slots. Removed both buttons from empty AMS and HT AMS slot popups. External spool holders are unaffected. Reported by @RosdasHH.
+- **Log Flood: "State is FINISH but completion NOT triggered"** ([#790](https://github.com/maziggy/bambuddy/issues/790)) — A diagnostic log message introduced in 0.2.2.1 fired on every MQTT update while a printer sat in FINISH or FAILED state, flooding logs with thousands of lines per minute in printer farms. Fixed by only logging once on the initial state transition. Reported by @user.
 
 
 ## [0.2.2.1] - 2026-03-22
 ## [0.2.2.1] - 2026-03-22
 
 

+ 7 - 2
backend/app/services/bambu_mqtt.py

@@ -2416,8 +2416,13 @@ class BambuMQTTClient:
         ):
         ):
             should_trigger_completion = True
             should_trigger_completion = True
 
 
-        # Log when we see a terminal state but DON'T trigger completion (diagnostics)
-        if not should_trigger_completion and self.state.state in ("FINISH", "FAILED"):
+        # Log when we FIRST see a terminal state but DON'T trigger completion (diagnostics)
+        # Only log on the transition (prev != current) to avoid flooding logs every MQTT update
+        if (
+            not should_trigger_completion
+            and self.state.state in ("FINISH", "FAILED")
+            and self._previous_gcode_state != self.state.state
+        ):
             logger.info(
             logger.info(
                 f"[{self.serial_number}] State is {self.state.state} but completion NOT triggered: "
                 f"[{self.serial_number}] State is {self.state.state} but completion NOT triggered: "
                 f"prev={self._previous_gcode_state}, was_running={self._was_running}, "
                 f"prev={self._previous_gcode_state}, was_running={self._was_running}, "