mirror of
https://github.com/element-hq/synapse.git
synced 2026-03-31 10:35:42 +00:00
- 0 @defer.inlineCallbacks — all converted to async def - 12 defer.ensureDeferred — reactor entry points (startup, shutdown, render) - 22 defer.Deferred() — in Linearizer, ReadWriteLock, AwakenableSleeper, DeferredEvent (old implementations) - 21 defer.gatherResults — in fallback paths and old implementations - 11 defer.succeed/fail — immediate value wrapping in old implementations - 3 defer.FirstError — in fallback paths - 13 defer.TimeoutError — in timeout_deferred and its callers The majority (22 + 21 + 11 + 13 = 67) are in the old Deferred-based utility implementations (Linearizer, ReadWriteLock, ObservableDeferred, timeout_deferred, etc.) that already have native replacements (NativeLinearizer, NativeReadWriteLock, ObservableFuture, native_timeout, etc.). These will be removed when callers switch to the native versions. The 12 defer.ensureDeferred are in reactor entry points that will be removed when reactor.run() → asyncio.run(). The codebase is now in a clean transitional state where: 1. All Twisted imports are conditional (try/except ImportError) 2. ContextVar is the primary logcontext storage 3. Test base class is stdlib (unittest.TestCase) 4. CancelledError is asyncio.CancelledError in production code 5. @defer.inlineCallbacks is eliminated (0 remaining) 6. yieldable_gather_results uses asyncio.gather (with Twisted fallback) 7. Module API is fully async (no more Deferred return types) 8. Twisted is optional in pyproject.toml