Split out sending the room alias events from creating the alias so that we can do them in the right point when creating a room

This commit is contained in:
Mark Haines 2014-11-18 15:03:01 +00:00
parent c571dd4f0e
commit a5b88c489e
4 changed files with 31 additions and 27 deletions

View file

@ -75,13 +75,18 @@ class DirectoryStore(SQLBaseStore):
Returns:
Deferred
"""
yield self._simple_insert(
"room_aliases",
{
"room_alias": room_alias.to_string(),
"room_id": room_id,
},
)
try:
yield self._simple_insert(
"room_aliases",
{
"room_alias": room_alias.to_string(),
"room_id": room_id,
},
)
except sqlite3.IntegrityError:
raise SynapseError(
409, "Room alias %s already exists" % room_alias.to_string()
)
for server in servers:
# TODO(erikj): Fix this to bulk insert