Files
synapse/tests
Matthew Hodgson e62175ac44 fix faketime
⏺ All 9 ratelimit tests pass when run together.

  Here's a summary of the fix:

  Root cause: _advance_time in make_request was jumping fake time to the next pending sleep's wake time. This fired looping call sleeps (5s+ intervals), which re-scheduled themselves, creating a chain of 5s+ time jumps per
  request. With 10+ requests, fake time advanced 50+ seconds, fully refilling ratelimit token buckets.

  Fix (two parts):

  1. tests/server.py _advance_time: Changed from jumping to next pending sleep to advancing in tiny 1ms increments. At 1ms per event loop iteration, even thousands of iterations only add a few seconds of fake time — too
  little to meaningfully refill ratelimit buckets (0.2 tokens/sec × a few seconds ≈ 1 token).
  2. tests/server.py clock auto-detection: Added if clock is None and hasattr(reactor, '_clock'): clock = reactor._clock so that callers like RestHelper (which don't pass clock=) still get fake time advancement. Without this,
   requests that hit ratelimit pauses (clock.sleep()) would hang forever.
2026-03-24 15:26:11 -04:00
..
2026-03-21 19:33:50 +00:00
2026-03-21 19:33:50 +00:00
2026-03-21 19:33:50 +00:00
2026-03-21 19:33:50 +00:00
2026-03-21 19:33:50 +00:00
2026-03-21 19:33:50 +00:00
2026-03-21 19:33:50 +00:00
2026-03-21 19:33:50 +00:00
2026-03-21 19:33:50 +00:00
2026-03-21 19:33:50 +00:00
2026-03-23 20:59:57 -04:00
2026-03-21 19:33:50 +00:00
2026-03-24 15:26:11 -04:00
2026-03-21 19:33:50 +00:00
2026-03-21 19:33:50 +00:00
2026-03-23 20:59:57 -04:00