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

This commit is contained in:
Patrick Cloke
2020-10-05 09:40:19 -04:00
committed by GitHub
parent c5251c6fbd
commit f64c6aae68
2 changed files with 6 additions and 2 deletions
+1
View File
@@ -0,0 +1 @@
Update the directions for using the manhole with coroutines.
+5 -2
View File
@@ -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
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:
```
>>> hs.get_datastore().get_event('$1416420717069yeQaw:matrix.org')
```pycon
>>> 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=''>>
```