Added some rss fixes
This commit is contained in:
18
rss2bsky.py
18
rss2bsky.py
@@ -57,8 +57,8 @@ class RetryConfig:
|
||||
post_retry_delay_seconds: int = 2
|
||||
|
||||
# Login hardening
|
||||
login_max_attempts: int = 4
|
||||
login_base_delay_seconds: int = 10
|
||||
login_max_attempts: int = 5
|
||||
login_base_delay_seconds: int = 2
|
||||
login_max_delay_seconds: int = 600
|
||||
login_jitter_seconds: float = 1.5
|
||||
|
||||
@@ -1088,20 +1088,34 @@ def login_with_backoff(
|
||||
except Exception as e:
|
||||
logging.exception("❌ Login exception")
|
||||
|
||||
# Rate-limited login: retry first, cooldown only if exhausted
|
||||
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)
|
||||
return False
|
||||
|
||||
# Bad credentials: fail fast
|
||||
if is_auth_error(e):
|
||||
logging.error("❌ Authentication failed (bad handle/password/app-password).")
|
||||
return False
|
||||
|
||||
# Network/transient: bounded retry
|
||||
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)
|
||||
logging.warning(f"⏳ Transient login failure. Retrying in {delay:.1f}s...")
|
||||
time.sleep(delay)
|
||||
continue
|
||||
|
||||
# Other errors: bounded retry
|
||||
if attempt < max_attempts:
|
||||
delay = min(base_delay * attempt, max_delay) + random.uniform(0, jitter_max)
|
||||
logging.warning(f"⏳ Login retry in {delay:.1f}s...")
|
||||
|
||||
Reference in New Issue
Block a user