1. Runtime tracking - Removed the 60s upper bound so restarts don't break hour counting

2. Chamber stream check - Added _active_chamber_streams check for A1/P1 printers (proactive)
3. Browser freeze - Removed immediate printerStatus invalidation on print_complete
This commit is contained in:
maziggy
2026-01-06 09:10:59 +01:00
parent c960b91f2a
commit fe1d10b705
4 changed files with 10 additions and 8 deletions
+6 -2
View File
@@ -1168,7 +1168,7 @@ async def on_print_complete(printer_id: int, data: dict):
try:
logger.info(f"[PHOTO-BG] Starting finish photo capture for archive {archive_id}")
from backend.app.api.routes.camera import _active_streams, get_buffered_frame
from backend.app.api.routes.camera import _active_chamber_streams, _active_streams, get_buffered_frame
async with async_session() as db:
from backend.app.api.routes.settings import get_setting
@@ -1196,10 +1196,14 @@ async def on_print_complete(printer_id: int, data: dict):
photo_filename = None
# Check if camera stream is active - use buffered frame to avoid freeze
# Check both RTSP streams (_active_streams) and chamber image streams (_active_chamber_streams)
active_for_printer = [k for k in _active_streams if k.startswith(f"{printer_id}-")]
active_chamber_for_printer = [
k for k in _active_chamber_streams if k.startswith(f"{printer_id}-")
]
buffered_frame = get_buffered_frame(printer_id)
if active_for_printer and buffered_frame:
if (active_for_printer or active_chamber_for_printer) and buffered_frame:
# Use frame from active stream
logger.info("[PHOTO-BG] Using buffered frame from active stream")
photos_dir = archive_dir / "photos"
+2 -4
View File
@@ -196,10 +196,8 @@ export function useWebSocket() {
break;
case 'print_complete':
// Refetch printer status when print completes to clear printable_objects_count
if (message.printer_id !== undefined) {
queryClient.invalidateQueries({ queryKey: ['printerStatus', message.printer_id] });
}
// Don't invalidate printerStatus here - it causes re-render cascade and browser freeze
// The printer_status websocket messages will naturally update the status
debouncedInvalidate('archives');
debouncedInvalidate('archiveStats');
break;
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -23,7 +23,7 @@
<!-- Splash screens for iOS -->
<link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
<script type="module" crossorigin src="/assets/index-CCnKMi2S.js"></script>
<script type="module" crossorigin src="/assets/index-3dBx4a1x.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CrUIX1oi.css">
</head>
<body>