summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2018-11-27 11:53:20 +0000
committerBrendan Abolivier <babolivier@matrix.org>2019-02-13 15:16:03 +0000
commitae7460b9f4700c202f123d8e4c9a6879d2d83bff (patch)
tree2eddf311ffbfd522c42e597eab143c4a6fc0dc6c
parentOpentracing. Reduce event ID size (diff)
downloadsynapse-ae7460b9f4700c202f123d8e4c9a6879d2d83bff.tar.xz
Make room ID smaller
-rw-r--r--synapse/handlers/room.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py
index 3928faa6e7..54183089e1 100644
--- a/synapse/handlers/room.py
+++ b/synapse/handlers/room.py
@@ -79,6 +79,8 @@ class RoomCreationHandler(BaseHandler):
         # linearizer to stop two upgrades happening at once
         self._upgrade_linearizer = Linearizer("room_upgrade_linearizer")
 
+        self._next_room_id = 0
+
     @defer.inlineCallbacks
     def upgrade_room(self, requester, old_room_id, new_version):
         """Replace a room with a new room with a different version
@@ -741,7 +743,9 @@ class RoomCreationHandler(BaseHandler):
         attempts = 0
         while attempts < 5:
             try:
-                random_string = stringutils.random_string(18)
+                i = self._next_room_id
+                self._next_room_id += 1
+                random_string = stringutils.random_string(3) + str(i)
                 gen_room_id = RoomID(
                     random_string,
                     self.hs.hostname,