Skip to content
Snippets Groups Projects
Unverified Commit f64c6aae authored by Patrick Cloke's avatar Patrick Cloke Committed by GitHub
Browse files

Update manhole documentation for async/await. (#8462)

parent c5251c6f
No related branches found
No related tags found
No related merge requests found
Update the directions for using the manhole with coroutines.
...@@ -35,9 +35,12 @@ This gives a Python REPL in which `hs` gives access to the ...@@ -35,9 +35,12 @@ This gives a Python REPL in which `hs` gives access to the
`synapse.server.HomeServer` object - which in turn gives access to many other `synapse.server.HomeServer` object - which in turn gives access to many other
parts of the process. parts of the process.
Note that any call which returns a coroutine will need to be wrapped in `ensureDeferred`.
As a simple example, retrieving an event from the database: As a simple example, retrieving an event from the database:
``` ```pycon
>>> hs.get_datastore().get_event('$1416420717069yeQaw:matrix.org') >>> from twisted.internet import defer
>>> defer.ensureDeferred(hs.get_datastore().get_event('$1416420717069yeQaw:matrix.org'))
<Deferred at 0x7ff253fc6998 current result: <FrozenEvent event_id='$1416420717069yeQaw:matrix.org', type='m.room.create', state_key=''>> <Deferred at 0x7ff253fc6998 current result: <FrozenEvent event_id='$1416420717069yeQaw:matrix.org', type='m.room.create', state_key=''>>
``` ```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment