diff options
author | Erik Johnston <erik@matrix.org> | 2020-08-25 15:10:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-25 15:10:08 +0100 |
commit | 2231dffee6788836c86e868dd29574970b13dd18 (patch) | |
tree | 0e558b50207e5b85d00e0f1eb3d90a954dd0b04c /synapse/storage/util | |
parent | Wording fixes to 'name' user admin api filter (#8163) (diff) | |
download | synapse-2231dffee6788836c86e868dd29574970b13dd18.tar.xz |
Make StreamIdGen `get_next` and `get_next_mult` async (#8161)
This is mainly so that `StreamIdGenerator` and `MultiWriterIdGenerator` will have the same interface, allowing them to be used interchangeably.
Diffstat (limited to 'synapse/storage/util')
-rw-r--r-- | synapse/storage/util/id_generators.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/synapse/storage/util/id_generators.py b/synapse/storage/util/id_generators.py index 0bf772d4d1..ddb5c8c60c 100644 --- a/synapse/storage/util/id_generators.py +++ b/synapse/storage/util/id_generators.py @@ -80,7 +80,7 @@ class StreamIdGenerator(object): upwards, -1 to grow downwards. Usage: - with stream_id_gen.get_next() as stream_id: + with await stream_id_gen.get_next() as stream_id: # ... persist event ... """ @@ -95,10 +95,10 @@ class StreamIdGenerator(object): ) self._unfinished_ids = deque() # type: Deque[int] - def get_next(self): + async def get_next(self): """ Usage: - with stream_id_gen.get_next() as stream_id: + with await stream_id_gen.get_next() as stream_id: # ... persist event ... """ with self._lock: @@ -117,10 +117,10 @@ class StreamIdGenerator(object): return manager() - def get_next_mult(self, n): + async def get_next_mult(self, n): """ Usage: - with stream_id_gen.get_next(n) as stream_ids: + with await stream_id_gen.get_next(n) as stream_ids: # ... persist events ... """ with self._lock: |