fix: anti-stall — IP check budgets, capped timers, fetch wait_for, obfuscation auto-fallback, empty validate short-circuit, unittest suite
Made-with: Cursor
This commit is contained in:
@@ -95,16 +95,24 @@ def sanitize_settings(s: Settings) -> tuple[Settings, bool]:
|
||||
s.local_port = 18888
|
||||
changed = True
|
||||
try:
|
||||
if int(s.health_check_seconds) < 10:
|
||||
hc = int(s.health_check_seconds)
|
||||
if hc < 10:
|
||||
s.health_check_seconds = 10
|
||||
changed = True
|
||||
elif hc > 3600:
|
||||
s.health_check_seconds = 3600
|
||||
changed = True
|
||||
except (TypeError, ValueError):
|
||||
s.health_check_seconds = 180
|
||||
changed = True
|
||||
try:
|
||||
if int(s.full_refresh_seconds) < 60:
|
||||
fr = int(s.full_refresh_seconds)
|
||||
if fr < 60:
|
||||
s.full_refresh_seconds = 60
|
||||
changed = True
|
||||
elif fr > 86400:
|
||||
s.full_refresh_seconds = 86400
|
||||
changed = True
|
||||
except (TypeError, ValueError):
|
||||
s.full_refresh_seconds = 1800
|
||||
changed = True
|
||||
@@ -123,9 +131,13 @@ def sanitize_settings(s: Settings) -> tuple[Settings, bool]:
|
||||
s.max_candidates = 400
|
||||
changed = True
|
||||
try:
|
||||
if float(s.validation_timeout_seconds) < 2.0:
|
||||
vt = float(s.validation_timeout_seconds)
|
||||
if vt < 2.0:
|
||||
s.validation_timeout_seconds = 2.0
|
||||
changed = True
|
||||
elif vt > 120.0:
|
||||
s.validation_timeout_seconds = 120.0
|
||||
changed = True
|
||||
except (TypeError, ValueError):
|
||||
s.validation_timeout_seconds = 12.0
|
||||
changed = True
|
||||
|
||||
Reference in New Issue
Block a user