Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Update manhole documentation for async/await. #8462

Merged
merged 2 commits into from
Oct 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/8462.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update the directions for using the manhole with coroutines.
7 changes: 5 additions & 2 deletions docs/manhole.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=''>>
```