fix: validate atomic configuration updates and expire stale monitoring snapshots

This commit is contained in:
way
2026-10-18 18:15:22 +08:00
parent c82d9ab3c2
commit 9b83937d60
10 changed files with 244 additions and 85 deletions
+1 -1
View File
@@ -174,7 +174,7 @@ class StorageCache:
values = data['values']
if all(isinstance(values[k], int) and not isinstance(values[k], bool) and values[k] >= 0 for k in ('total', 'used', 'free')) and values['total'] > 0 and values['used'] <= values['total']:
at = data['observed_at']
if isinstance(at, (int, float)) and 0 <= self.clock() - at < 90000:
if isinstance(at, (int, float)) and 0 <= self.clock() - at < 604800:
self.values, self.observed_at = values, at
if not self.error:self.next_update_at = at + 604800
except (OSError, ValueError, KeyError, TypeError):