fix: save Modified attribute and SSE retry reset #17
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user