diff --git a/freecad/silo_commands.py b/freecad/silo_commands.py index a2398aa..c056568 100644 --- a/freecad/silo_commands.py +++ b/freecad/silo_commands.py @@ -2350,23 +2350,30 @@ class SiloEventListener(QtCore.QThread): # -- thread entry ------------------------------------------------------- def run(self): + import time + retries = 0 last_error = "" while not self._stop_flag: + t0 = time.monotonic() try: self._listen() # _listen returns normally only on clean EOF / stop if self._stop_flag: return - retries += 1 last_error = "connection closed" except _SSEUnsupported: self.connection_status.emit("unsupported", 0, "") return except Exception as exc: - retries += 1 last_error = str(exc) or "unknown error" + # Reset retries if the connection was up for a while + elapsed = time.monotonic() - t0 + if elapsed > 30: + retries = 0 + retries += 1 + if retries > self._MAX_RETRIES: self.connection_status.emit("gave_up", retries - 1, last_error) return diff --git a/freecad/silo_origin.py b/freecad/silo_origin.py index 5efe09c..131b0d0 100644 --- a/freecad/silo_origin.py +++ b/freecad/silo_origin.py @@ -399,7 +399,10 @@ class SiloOrigin: return True except Exception as e: + import traceback + FreeCAD.Console.PrintError(f"Silo save failed: {e}\n") + FreeCAD.Console.PrintError(traceback.format_exc()) return False def saveDocumentAs(self, doc, newIdentity: str) -> bool: