mirror of
https://github.com/element-hq/synapse.git
synced 2026-04-14 10:26:25 +00:00
- 11 http/client.py — Twisted HTTP client (needs full aiohttp rewrite) - 5 connectproxyclient.py — Twisted proxy client (needs full rewrite) - 4 background_process_metrics.py — type annotations (harmless) - 4 _scripts/synapse_port_db.py — CLI script (low priority) - 3 server.py — startup/shutdown (type annotations + defer.ensureDeferred) - 3 app/_base.py — app startup (defer.ensureDeferred) - 2 http/server.py — type annotation + isinstance check - 1 manhole.py — interactive manhole - 1 util/__init__.py — unwrapFirstError compat - 1 crypto/keyring.py — type annotation - 1 admin_cmd.py — CLI script - 1 _scripts/update_synapse_database.py — CLI script Here's a summary of what was accomplished in this session: Completed: Replaced all .addErrback/.addCallback/.addBoth calls on production code that was receiving asyncio Tasks instead of Deferreds. Files fixed: 1. cached_call.py — Replaced Deferred/Failure/.addBoth with asyncio.Task/add_done_callback 2. response_cache.py — Replaced .addBoth with add_done_callback, .called with has_called() 3. push_rule.py — Replaced gather_results(...).addErrback(unwrapFirstError) with await gather_results(...) 4. bulk_push_rule_evaluator.py — Same pattern 5. events_worker.py — Replaced defer.Deferred() with asyncio.Future(), defer.gatherResults with asyncio.gather, .errback()/.callback() with .set_exception()/.set_result() 6. partial_state_events_tracker.py — Same pattern, both PartialStateEventsTracker and PartialCurrentStateTracker 7. initial_sync.py — Replaced .addCallback chain with async wrapper, removed gather_results().addErrback() 8. message.py — Replaced .addErrback on Task with try/except wrapper 9. federation_server.py — Removed gather_results().addErrback() 10. transactions.py — Replaced .addErrback with add_done_callback 11. e2e_keys.py, appservice.py, sender/__init__.py, stream.py, persist_events.py, notifier.py, batching_queue.py — All migrated from Twisted to asyncio Also fixed: - NativeLoopingCall missing .running property - Heapq tiebreaker for _pending_sleeps (Future comparison error) - FakeChannel.await_result now advances NativeClock fake time - run_in_background returns resolved Futures for plain values (not unawaited coroutines) Remaining 37 defer.* calls are in HTTP client (needs full rewrite), type annotations, startup code, and CLI scripts — all expected.