Browse Source

fix(printer): stop the File Manager polling the printer over FTPS every 30s (#1480)

  FileManagerModal ran its file-listing query with refetchInterval 30000,
  opening a fresh FTPS connection (full TLS handshake) to the printer every
  30s while the modal was open. On fragile controllers like the P1S that
  load tipped MQTT, FTP and the camera into simultaneous timeouts. Drop the
  interval; the listing still refreshes on open, directory change, after
  upload/delete, and via the manual Refresh button.

  Also log STL thumbnail failures with a traceback (exc_info) so a
  data-specific "str / str" TypeError can be located from a support bundle.
maziggy 5 days ago
parent
commit
50d1984820

File diff suppressed because it is too large
+ 2 - 0
CHANGELOG.md


+ 6 - 1
backend/app/services/stl_thumbnail.py

@@ -142,5 +142,10 @@ def generate_stl_thumbnail(
         logger.warning("STL thumbnail generation unavailable (missing dependencies): %s", e)
         logger.warning("STL thumbnail generation unavailable (missing dependencies): %s", e)
         return None
         return None
     except Exception as e:
     except Exception as e:
-        logger.warning("Failed to generate STL thumbnail for %s: %s", stl_path, e)
+        # Log the traceback, not just the message: a bare
+        # "unsupported operand type(s) for /: 'str' and 'str'" gives no clue
+        # which line failed, and the fault is data-/environment-specific
+        # enough that it can't be reproduced from a clean STL — the traceback
+        # in the next support bundle is what pinpoints it (#1480).
+        logger.warning("Failed to generate STL thumbnail for %s: %s", stl_path, e, exc_info=True)
         return None
         return None

+ 6 - 1
frontend/src/components/FileManagerModal.tsx

@@ -300,10 +300,15 @@ export function FileManagerModal({ printerId, printerName, onClose }: FileManage
     return () => window.removeEventListener('keydown', handleKeyDown);
     return () => window.removeEventListener('keydown', handleKeyDown);
   }, [onClose]);
   }, [onClose]);
 
 
+  // No auto-poll: every refetch opens a fresh FTPS connection (TLS handshake
+  // and all) to the printer, and a 30s interval saturated fragile printer
+  // controllers like the P1S — MQTT, FTP and the camera all timed out
+  // together while this modal sat open (#1480). A printer's file list only
+  // changes on upload / delete (the mutations below invalidate the query)
+  // or when a print finishes; the manual Refresh button covers the rest.
   const { data, isLoading, refetch } = useQuery({
   const { data, isLoading, refetch } = useQuery({
     queryKey: ['printerFiles', printerId, currentPath],
     queryKey: ['printerFiles', printerId, currentPath],
     queryFn: () => api.getPrinterFiles(printerId, currentPath),
     queryFn: () => api.getPrinterFiles(printerId, currentPath),
-    refetchInterval: 30000,
   });
   });
 
 
   const { data: storageData } = useQuery({
   const { data: storageData } = useQuery({

File diff suppressed because it is too large
+ 0 - 0
static/assets/index-B7aP7po9.js


+ 1 - 1
static/index.html

@@ -26,7 +26,7 @@
 
 
     <!-- Splash screens for iOS -->
     <!-- Splash screens for iOS -->
     <link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
     <link rel="apple-touch-startup-image" href="/img/android-chrome-512x512.png" />
-    <script type="module" crossorigin src="/assets/index-B2ysIPjO.js"></script>
+    <script type="module" crossorigin src="/assets/index-B7aP7po9.js"></script>
     <link rel="stylesheet" crossorigin href="/assets/index-CBuiHfeb.css">
     <link rel="stylesheet" crossorigin href="/assets/index-CBuiHfeb.css">
   </head>
   </head>
   <body>
   <body>

Some files were not shown because too many files changed in this diff