rate-limiting feinschliff: 429-retry, API-call reduction, auto-route detection
AUFGABE 1 — test_03 API-calls reduzieren: - Skip get_latest_timestamp on source room; use post_message's returned ts as cursor (saves 1 channels.history call) - Source polling: initial_interval=5s (was 2s), timeout=30s (was 25s) - Target polling: timeout=60s (was 25s), initial_interval=8s (was 2s) - post_message() now returns (msg_id, ts) tuple — all call sites updated AUFGABE 2 — 429-retry strategy verbessern: - rc_rest.py: 5 retries with 3s/6s/12s/20s/30s backoff (was 3 retries 3s/6s/12s) - polling.py: 5 consecutive 429s before RateLimitSkip (was 3) - polling.py: 429 backoff max 30s (was 24s) AUFGABE 3 — rate-limit-cooldown erhöhen: - conftest.py: 20s between tests (was 15s) AUFGABE 4 — test_03 auto-route robustness: - Detect auto-route (wechseln/sehe dich/thema) vs button-move-request (kopieren/rüber/attachments) - Auto-route: pytest.skip with reason, no button click, no target verification - Button-request: proceed with existing button-click + target-verification flow
This commit is contained in:
@@ -254,14 +254,15 @@ def _suite_cleanup(request, rc_config: dict):
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def rate_limit_cooldown():
|
||||
"""Wait 15s between tests for RC rate-limit window reset.
|
||||
"""Wait 20s between tests for RC rate-limit window reset.
|
||||
|
||||
RC's rate-limit window is ~10s. A 15s pause between tests ensures
|
||||
RC's rate-limit window is ~10s. A 20s pause between tests ensures
|
||||
the token bucket has time to refill, preventing cascading 429s
|
||||
when tests run back-to-back.
|
||||
when tests run back-to-back. Increased from 15s — test_03 makes
|
||||
more API calls and needs extra headroom.
|
||||
"""
|
||||
yield
|
||||
time.sleep(15)
|
||||
time.sleep(20)
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
@@ -384,7 +385,7 @@ def post_test_message(
|
||||
text: str,
|
||||
posted_ids: list,
|
||||
limiter: RateLimiter | None = None,
|
||||
) -> str:
|
||||
) -> tuple[str, str]:
|
||||
"""Post a test message with cleanup tracking.
|
||||
|
||||
Rate limiting is handled by the RCRestClient internally (via _request).
|
||||
@@ -398,11 +399,11 @@ def post_test_message(
|
||||
limiter: Deprecated — rate limiting is now in RCRestClient._request().
|
||||
|
||||
Returns:
|
||||
The message _id.
|
||||
A tuple of (message_id, timestamp) from the API response.
|
||||
"""
|
||||
msg_id = client.post_message(room_id, text)
|
||||
msg_id, ts = client.post_message(room_id, text)
|
||||
posted_ids.append(msg_id)
|
||||
return msg_id
|
||||
return msg_id, ts
|
||||
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
|
||||
Reference in New Issue
Block a user