summary refs log tree commit diff
path: root/docs
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2017-03-31 10:11:07 +0100
committerErik Johnston <erik@matrix.org>2017-03-31 10:11:07 +0100
commitd7dbc56c716e805c61f768e35acba590ec86667b (patch)
treedaeebe671813605cd33e13b72374f611c0a2b549 /docs
parentMerge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes (diff)
parentMerge pull request #2075 from matrix-org/erikj/cache_speed (diff)
downloadsynapse-d7dbc56c716e805c61f768e35acba590ec86667b.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into matrix-org-hotfixes
Diffstat (limited to 'docs')
-rw-r--r--docs/log_contexts.rst11
1 files changed, 8 insertions, 3 deletions
diff --git a/docs/log_contexts.rst b/docs/log_contexts.rst

index 8d04a973de..eb1784e700 100644 --- a/docs/log_contexts.rst +++ b/docs/log_contexts.rst
@@ -204,9 +204,14 @@ That doesn't follow the rules, but we can fix it by wrapping it with This technique works equally for external functions which return deferreds, or deferreds we have made ourselves. -XXX: think this is what ``preserve_context_over_deferred`` is supposed to do, -though it is broken, in that it only restores the logcontext for the duration -of the callbacks, which doesn't comply with the logcontext rules. +You can also use ``logcontext.make_deferred_yieldable``, which just does the +boilerplate for you, so the above could be written: + +.. code:: python + + def sleep(seconds): + return logcontext.make_deferred_yieldable(get_sleep_deferred(seconds)) + Fire-and-forget ---------------