fixes
This commit is contained in:
@@ -65,8 +65,18 @@ logger = logging.getLogger("zeus-email-poller")
|
||||
# ---------------------------------------------------------------------------
|
||||
def load_state() -> dict:
|
||||
if os.path.exists(STATE_FILE):
|
||||
with open(STATE_FILE) as f:
|
||||
return json.load(f)
|
||||
try:
|
||||
with open(STATE_FILE) as f:
|
||||
content = f.read().strip()
|
||||
if not content:
|
||||
return {"processed_uids": [], "last_check": None}
|
||||
data = json.loads(content)
|
||||
if isinstance(data, dict):
|
||||
return data
|
||||
else:
|
||||
logger.warning(f"State file corrupted (not a dict), resetting")
|
||||
except (json.JSONDecodeError, IOError) as e:
|
||||
logger.warning(f"State file corrupted: {e}, resetting")
|
||||
return {"processed_uids": [], "last_check": None}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user