Added some rss fixes

This commit is contained in:
Guillem Hernandez Sola
2026-04-18 11:18:55 +02:00
parent 6565c62a7a
commit baa055a36e

View File

@@ -57,8 +57,8 @@ class RetryConfig:
post_retry_delay_seconds: int = 2 post_retry_delay_seconds: int = 2
# Login hardening # Login hardening
login_max_attempts: int = 4 login_max_attempts: int = 5
login_base_delay_seconds: int = 10 login_base_delay_seconds: int = 2
login_max_delay_seconds: int = 600 login_max_delay_seconds: int = 600
login_jitter_seconds: float = 1.5 login_jitter_seconds: float = 1.5
@@ -1088,20 +1088,34 @@ def login_with_backoff(
except Exception as e: except Exception as e:
logging.exception("❌ Login exception") logging.exception("❌ Login exception")
# Rate-limited login: retry first, cooldown only if exhausted
if is_rate_limited_error(e): if is_rate_limited_error(e):
if attempt < max_attempts:
wait_seconds = get_rate_limit_wait_seconds(e, base_delay, cfg)
wait_seconds = min(wait_seconds, max_delay) + random.uniform(0, jitter_max)
logging.warning(
f"⏳ Login rate-limited. Retrying in {wait_seconds:.1f}s "
f"(attempt {attempt}/{max_attempts})"
)
time.sleep(wait_seconds)
continue
activate_post_creation_cooldown_from_error(e, cooldown_path, cfg) activate_post_creation_cooldown_from_error(e, cooldown_path, cfg)
return False return False
# Bad credentials: fail fast
if is_auth_error(e): if is_auth_error(e):
logging.error("❌ Authentication failed (bad handle/password/app-password).") logging.error("❌ Authentication failed (bad handle/password/app-password).")
return False return False
# Network/transient: bounded retry
if attempt < max_attempts and (is_network_error(e) or is_timeout_error(e)): if attempt < max_attempts and (is_network_error(e) or is_timeout_error(e)):
delay = min(base_delay * attempt, max_delay) + random.uniform(0, jitter_max) delay = min(base_delay * attempt, max_delay) + random.uniform(0, jitter_max)
logging.warning(f"⏳ Transient login failure. Retrying in {delay:.1f}s...") logging.warning(f"⏳ Transient login failure. Retrying in {delay:.1f}s...")
time.sleep(delay) time.sleep(delay)
continue continue
# Other errors: bounded retry
if attempt < max_attempts: if attempt < max_attempts:
delay = min(base_delay * attempt, max_delay) + random.uniform(0, jitter_max) delay = min(base_delay * attempt, max_delay) + random.uniform(0, jitter_max)
logging.warning(f"⏳ Login retry in {delay:.1f}s...") logging.warning(f"⏳ Login retry in {delay:.1f}s...")