Files
synapse/tests/util
Matthew Hodgson 145757e9e3 Let me summarize the progress so far while we wait. The key breakthrough is that make_deferred_yieldable can be a hybrid function — it detects whether it's given a Twisted Deferred or a native
awaitable and handles each appropriately:

  - Twisted Deferred: synchronously adds logcontext callbacks (classic behavior, 100% backward compatible)
  - Native awaitable (asyncio.Future, coroutine): returns an async wrapper that saves/restores logcontext

  This means the migration can be incremental — code that still uses Deferreds works unchanged, while new code using native awaitables also works. The make_deferred_yieldable function becomes
  the bridge.

  The same pattern applies to run_in_background — it already handles both Deferreds and coroutines (via defer.ensureDeferred). It doesn't need to change.

  This is a much better approach than the "flag day" — it allows gradual migration of individual subsystems from Deferred→asyncio without breaking anything.
2026-03-21 16:26:41 +00:00
..
2023-11-21 15:29:58 -05:00