mirror of
https://github.com/element-hq/synapse.git
synced 2026-11-04 19:57:45 +00:00
Cancelling a deferred from `create_deferred` failed it at once and left the tokio task running to completion, its result thrown away. That is the right behaviour for a cache load, which other callers may be waiting on, but wrong for work only the cancelled caller wanted: a `/sync` request's per-room loop, say, which clients abandon constantly and which holds a pooled connection while it runs. `create_deferred_with` takes an `OnCancel`. With `Abort`, the deferred's canceller aborts the task, so its future is dropped where it stands and whatever it holds is released by `Drop`. The default stays as it was. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0194eNQP5weBtVMg8NKtc6VU