Give sensible names for '_simple_...' transactions

This commit is contained in:
Erik Johnston 2015-03-20 15:59:18 +00:00
parent fce0114005
commit dc0c989ef4
13 changed files with 93 additions and 38 deletions

View File

@ -83,7 +83,8 @@ class DataStore(RoomMemberStore, RoomStore,
"ip": ip, "ip": ip,
"user_agent": user_agent, "user_agent": user_agent,
"last_seen": int(self._clock.time_msec()), "last_seen": int(self._clock.time_msec()),
} },
desc="insert_client_ip",
) )
def get_user_ip_and_agents(self, user): def get_user_ip_and_agents(self, user):
@ -93,6 +94,7 @@ class DataStore(RoomMemberStore, RoomStore,
retcols=[ retcols=[
"device_id", "access_token", "ip", "user_agent", "last_seen" "device_id", "access_token", "ip", "user_agent", "last_seen"
], ],
desc="get_user_ip_and_agents",
) )

View File

@ -321,7 +321,8 @@ class SQLBaseStore(object):
# "Simple" SQL API methods that operate on a single table with no JOINs, # "Simple" SQL API methods that operate on a single table with no JOINs,
# no complex WHERE clauses, just a dict of values for columns. # no complex WHERE clauses, just a dict of values for columns.
def _simple_insert(self, table, values, or_replace=False, or_ignore=False): def _simple_insert(self, table, values, or_replace=False, or_ignore=False,
desc="_simple_insert"):
"""Executes an INSERT query on the named table. """Executes an INSERT query on the named table.
Args: Args:
@ -330,7 +331,7 @@ class SQLBaseStore(object):
or_replace : bool; if True performs an INSERT OR REPLACE or_replace : bool; if True performs an INSERT OR REPLACE
""" """
return self.runInteraction( return self.runInteraction(
"_simple_insert", desc,
self._simple_insert_txn, table, values, or_replace=or_replace, self._simple_insert_txn, table, values, or_replace=or_replace,
or_ignore=or_ignore, or_ignore=or_ignore,
) )
@ -354,7 +355,7 @@ class SQLBaseStore(object):
txn.execute(sql, values.values()) txn.execute(sql, values.values())
return txn.lastrowid return txn.lastrowid
def _simple_upsert(self, table, keyvalues, values): def _simple_upsert(self, table, keyvalues, values, desc="_simple_upsert"):
""" """
Args: Args:
table (str): The table to upsert into table (str): The table to upsert into
@ -363,7 +364,7 @@ class SQLBaseStore(object):
Returns: A deferred Returns: A deferred
""" """
return self.runInteraction( return self.runInteraction(
"_simple_upsert", desc,
self._simple_upsert_txn, table, keyvalues, values self._simple_upsert_txn, table, keyvalues, values
) )
@ -418,7 +419,8 @@ class SQLBaseStore(object):
) )
def _simple_select_one_onecol(self, table, keyvalues, retcol, def _simple_select_one_onecol(self, table, keyvalues, retcol,
allow_none=False): allow_none=False,
desc="_simple_select_one_onecol"):
"""Executes a SELECT query on the named table, which is expected to """Executes a SELECT query on the named table, which is expected to
return a single row, returning a single column from it." return a single row, returning a single column from it."
@ -428,7 +430,7 @@ class SQLBaseStore(object):
retcol : string giving the name of the column to return retcol : string giving the name of the column to return
""" """
return self.runInteraction( return self.runInteraction(
"_simple_select_one_onecol", desc,
self._simple_select_one_onecol_txn, self._simple_select_one_onecol_txn,
table, keyvalues, retcol, allow_none=allow_none, table, keyvalues, retcol, allow_none=allow_none,
) )
@ -464,7 +466,8 @@ class SQLBaseStore(object):
return [r[0] for r in txn.fetchall()] return [r[0] for r in txn.fetchall()]
def _simple_select_onecol(self, table, keyvalues, retcol): def _simple_select_onecol(self, table, keyvalues, retcol,
desc="_simple_select_onecol"):
"""Executes a SELECT query on the named table, which returns a list """Executes a SELECT query on the named table, which returns a list
comprising of the values of the named column from the selected rows. comprising of the values of the named column from the selected rows.
@ -477,12 +480,13 @@ class SQLBaseStore(object):
Deferred: Results in a list Deferred: Results in a list
""" """
return self.runInteraction( return self.runInteraction(
"_simple_select_onecol", desc,
self._simple_select_onecol_txn, self._simple_select_onecol_txn,
table, keyvalues, retcol table, keyvalues, retcol
) )
def _simple_select_list(self, table, keyvalues, retcols): def _simple_select_list(self, table, keyvalues, retcols,
desc="_simple_select_list"):
"""Executes a SELECT query on the named table, which may return zero or """Executes a SELECT query on the named table, which may return zero or
more rows, returning the result as a list of dicts. more rows, returning the result as a list of dicts.
@ -493,7 +497,7 @@ class SQLBaseStore(object):
retcols : list of strings giving the names of the columns to return retcols : list of strings giving the names of the columns to return
""" """
return self.runInteraction( return self.runInteraction(
"_simple_select_list", desc,
self._simple_select_list_txn, self._simple_select_list_txn,
table, keyvalues, retcols table, keyvalues, retcols
) )
@ -587,7 +591,8 @@ class SQLBaseStore(object):
return dict(zip(retcols, row)) return dict(zip(retcols, row))
def _simple_selectupdate_one(self, table, keyvalues, updatevalues=None, def _simple_selectupdate_one(self, table, keyvalues, updatevalues=None,
retcols=None, allow_none=False): retcols=None, allow_none=False,
desc="_simple_selectupdate_one"):
""" Combined SELECT then UPDATE.""" """ Combined SELECT then UPDATE."""
def func(txn): def func(txn):
ret = None ret = None
@ -609,9 +614,9 @@ class SQLBaseStore(object):
) )
return ret return ret
return self.runInteraction("_simple_selectupdate_one", func) return self.runInteraction(desc, func)
def _simple_delete_one(self, table, keyvalues): def _simple_delete_one(self, table, keyvalues, desc="_simple_delete_one"):
"""Executes a DELETE query on the named table, expecting to delete a """Executes a DELETE query on the named table, expecting to delete a
single row. single row.
@ -630,9 +635,9 @@ class SQLBaseStore(object):
raise StoreError(404, "No row found") raise StoreError(404, "No row found")
if txn.rowcount > 1: if txn.rowcount > 1:
raise StoreError(500, "more than one row matched") raise StoreError(500, "more than one row matched")
return self.runInteraction("_simple_delete_one", func) return self.runInteraction(desc, func)
def _simple_delete(self, table, keyvalues): def _simple_delete(self, table, keyvalues, desc="_simple_delete"):
"""Executes a DELETE query on the named table. """Executes a DELETE query on the named table.
Args: Args:
@ -640,7 +645,7 @@ class SQLBaseStore(object):
keyvalues : dict of column names and values to select the row with keyvalues : dict of column names and values to select the row with
""" """
return self.runInteraction("_simple_delete", self._simple_delete_txn) return self.runInteraction(desc, self._simple_delete_txn)
def _simple_delete_txn(self, txn, table, keyvalues): def _simple_delete_txn(self, txn, table, keyvalues):
sql = "DELETE FROM %s WHERE %s" % ( sql = "DELETE FROM %s WHERE %s" % (

View File

@ -48,6 +48,7 @@ class DirectoryStore(SQLBaseStore):
{"room_alias": room_alias.to_string()}, {"room_alias": room_alias.to_string()},
"room_id", "room_id",
allow_none=True, allow_none=True,
desc="get_association_from_room_alias",
) )
if not room_id: if not room_id:
@ -58,6 +59,7 @@ class DirectoryStore(SQLBaseStore):
"room_alias_servers", "room_alias_servers",
{"room_alias": room_alias.to_string()}, {"room_alias": room_alias.to_string()},
"server", "server",
desc="get_association_from_room_alias",
) )
if not servers: if not servers:
@ -87,6 +89,7 @@ class DirectoryStore(SQLBaseStore):
"room_alias": room_alias.to_string(), "room_alias": room_alias.to_string(),
"room_id": room_id, "room_id": room_id,
}, },
desc="create_room_alias_association",
) )
except sqlite3.IntegrityError: except sqlite3.IntegrityError:
raise SynapseError( raise SynapseError(
@ -100,7 +103,8 @@ class DirectoryStore(SQLBaseStore):
{ {
"room_alias": room_alias.to_string(), "room_alias": room_alias.to_string(),
"server": server, "server": server,
} },
desc="create_room_alias_association",
) )
def delete_room_alias(self, room_alias): def delete_room_alias(self, room_alias):
@ -139,4 +143,5 @@ class DirectoryStore(SQLBaseStore):
"room_aliases", "room_aliases",
{"room_id": room_id}, {"room_id": room_id},
"room_alias", "room_alias",
desc="get_aliases_for_room",
) )

View File

@ -31,6 +31,7 @@ class FilteringStore(SQLBaseStore):
}, },
retcol="filter_json", retcol="filter_json",
allow_none=False, allow_none=False,
desc="get_user_filter",
) )
defer.returnValue(json.loads(def_json)) defer.returnValue(json.loads(def_json))

View File

@ -32,6 +32,7 @@ class MediaRepositoryStore(SQLBaseStore):
{"media_id": media_id}, {"media_id": media_id},
("media_type", "media_length", "upload_name", "created_ts"), ("media_type", "media_length", "upload_name", "created_ts"),
allow_none=True, allow_none=True,
desc="get_local_media",
) )
def store_local_media(self, media_id, media_type, time_now_ms, upload_name, def store_local_media(self, media_id, media_type, time_now_ms, upload_name,
@ -45,7 +46,8 @@ class MediaRepositoryStore(SQLBaseStore):
"upload_name": upload_name, "upload_name": upload_name,
"media_length": media_length, "media_length": media_length,
"user_id": user_id.to_string(), "user_id": user_id.to_string(),
} },
desc="store_local_media",
) )
def get_local_media_thumbnails(self, media_id): def get_local_media_thumbnails(self, media_id):
@ -55,7 +57,8 @@ class MediaRepositoryStore(SQLBaseStore):
( (
"thumbnail_width", "thumbnail_height", "thumbnail_method", "thumbnail_width", "thumbnail_height", "thumbnail_method",
"thumbnail_type", "thumbnail_length", "thumbnail_type", "thumbnail_length",
) ),
desc="get_local_media_thumbnails",
) )
def store_local_thumbnail(self, media_id, thumbnail_width, def store_local_thumbnail(self, media_id, thumbnail_width,
@ -70,7 +73,8 @@ class MediaRepositoryStore(SQLBaseStore):
"thumbnail_method": thumbnail_method, "thumbnail_method": thumbnail_method,
"thumbnail_type": thumbnail_type, "thumbnail_type": thumbnail_type,
"thumbnail_length": thumbnail_length, "thumbnail_length": thumbnail_length,
} },
desc="store_local_thumbnail",
) )
def get_cached_remote_media(self, origin, media_id): def get_cached_remote_media(self, origin, media_id):
@ -82,6 +86,7 @@ class MediaRepositoryStore(SQLBaseStore):
"filesystem_id", "filesystem_id",
), ),
allow_none=True, allow_none=True,
desc="get_cached_remote_media",
) )
def store_cached_remote_media(self, origin, media_id, media_type, def store_cached_remote_media(self, origin, media_id, media_type,
@ -97,7 +102,8 @@ class MediaRepositoryStore(SQLBaseStore):
"created_ts": time_now_ms, "created_ts": time_now_ms,
"upload_name": upload_name, "upload_name": upload_name,
"filesystem_id": filesystem_id, "filesystem_id": filesystem_id,
} },
desc="store_cached_remote_media",
) )
def get_remote_media_thumbnails(self, origin, media_id): def get_remote_media_thumbnails(self, origin, media_id):
@ -107,7 +113,8 @@ class MediaRepositoryStore(SQLBaseStore):
( (
"thumbnail_width", "thumbnail_height", "thumbnail_method", "thumbnail_width", "thumbnail_height", "thumbnail_method",
"thumbnail_type", "thumbnail_length", "filesystem_id", "thumbnail_type", "thumbnail_length", "filesystem_id",
) ),
desc="get_remote_media_thumbnails",
) )
def store_remote_media_thumbnail(self, origin, media_id, filesystem_id, def store_remote_media_thumbnail(self, origin, media_id, filesystem_id,
@ -125,5 +132,6 @@ class MediaRepositoryStore(SQLBaseStore):
"thumbnail_type": thumbnail_type, "thumbnail_type": thumbnail_type,
"thumbnail_length": thumbnail_length, "thumbnail_length": thumbnail_length,
"filesystem_id": filesystem_id, "filesystem_id": filesystem_id,
} },
desc="store_remote_media_thumbnail",
) )

View File

@ -21,6 +21,7 @@ class PresenceStore(SQLBaseStore):
return self._simple_insert( return self._simple_insert(
table="presence", table="presence",
values={"user_id": user_localpart}, values={"user_id": user_localpart},
desc="create_presence",
) )
def has_presence_state(self, user_localpart): def has_presence_state(self, user_localpart):
@ -29,6 +30,7 @@ class PresenceStore(SQLBaseStore):
keyvalues={"user_id": user_localpart}, keyvalues={"user_id": user_localpart},
retcols=["user_id"], retcols=["user_id"],
allow_none=True, allow_none=True,
desc="has_presence_state",
) )
def get_presence_state(self, user_localpart): def get_presence_state(self, user_localpart):
@ -36,6 +38,7 @@ class PresenceStore(SQLBaseStore):
table="presence", table="presence",
keyvalues={"user_id": user_localpart}, keyvalues={"user_id": user_localpart},
retcols=["state", "status_msg", "mtime"], retcols=["state", "status_msg", "mtime"],
desc="get_presence_state",
) )
def set_presence_state(self, user_localpart, new_state): def set_presence_state(self, user_localpart, new_state):
@ -45,6 +48,7 @@ class PresenceStore(SQLBaseStore):
updatevalues={"state": new_state["state"], updatevalues={"state": new_state["state"],
"status_msg": new_state["status_msg"], "status_msg": new_state["status_msg"],
"mtime": self._clock.time_msec()}, "mtime": self._clock.time_msec()},
desc="set_presence_state",
) )
def allow_presence_visible(self, observed_localpart, observer_userid): def allow_presence_visible(self, observed_localpart, observer_userid):
@ -52,6 +56,7 @@ class PresenceStore(SQLBaseStore):
table="presence_allow_inbound", table="presence_allow_inbound",
values={"observed_user_id": observed_localpart, values={"observed_user_id": observed_localpart,
"observer_user_id": observer_userid}, "observer_user_id": observer_userid},
desc="allow_presence_visible",
) )
def disallow_presence_visible(self, observed_localpart, observer_userid): def disallow_presence_visible(self, observed_localpart, observer_userid):
@ -59,6 +64,7 @@ class PresenceStore(SQLBaseStore):
table="presence_allow_inbound", table="presence_allow_inbound",
keyvalues={"observed_user_id": observed_localpart, keyvalues={"observed_user_id": observed_localpart,
"observer_user_id": observer_userid}, "observer_user_id": observer_userid},
desc="disallow_presence_visible",
) )
def is_presence_visible(self, observed_localpart, observer_userid): def is_presence_visible(self, observed_localpart, observer_userid):
@ -68,6 +74,7 @@ class PresenceStore(SQLBaseStore):
"observer_user_id": observer_userid}, "observer_user_id": observer_userid},
retcols=["observed_user_id"], retcols=["observed_user_id"],
allow_none=True, allow_none=True,
desc="is_presence_visible",
) )
def add_presence_list_pending(self, observer_localpart, observed_userid): def add_presence_list_pending(self, observer_localpart, observed_userid):
@ -76,6 +83,7 @@ class PresenceStore(SQLBaseStore):
values={"user_id": observer_localpart, values={"user_id": observer_localpart,
"observed_user_id": observed_userid, "observed_user_id": observed_userid,
"accepted": False}, "accepted": False},
desc="add_presence_list_pending",
) )
def set_presence_list_accepted(self, observer_localpart, observed_userid): def set_presence_list_accepted(self, observer_localpart, observed_userid):
@ -84,6 +92,7 @@ class PresenceStore(SQLBaseStore):
keyvalues={"user_id": observer_localpart, keyvalues={"user_id": observer_localpart,
"observed_user_id": observed_userid}, "observed_user_id": observed_userid},
updatevalues={"accepted": True}, updatevalues={"accepted": True},
desc="set_presence_list_accepted",
) )
def get_presence_list(self, observer_localpart, accepted=None): def get_presence_list(self, observer_localpart, accepted=None):
@ -95,6 +104,7 @@ class PresenceStore(SQLBaseStore):
table="presence_list", table="presence_list",
keyvalues=keyvalues, keyvalues=keyvalues,
retcols=["observed_user_id", "accepted"], retcols=["observed_user_id", "accepted"],
desc="get_presence_list",
) )
def del_presence_list(self, observer_localpart, observed_userid): def del_presence_list(self, observer_localpart, observed_userid):
@ -102,4 +112,5 @@ class PresenceStore(SQLBaseStore):
table="presence_list", table="presence_list",
keyvalues={"user_id": observer_localpart, keyvalues={"user_id": observer_localpart,
"observed_user_id": observed_userid}, "observed_user_id": observed_userid},
desc="del_presence_list",
) )

View File

@ -21,6 +21,7 @@ class ProfileStore(SQLBaseStore):
return self._simple_insert( return self._simple_insert(
table="profiles", table="profiles",
values={"user_id": user_localpart}, values={"user_id": user_localpart},
desc="create_profile",
) )
def get_profile_displayname(self, user_localpart): def get_profile_displayname(self, user_localpart):
@ -28,6 +29,7 @@ class ProfileStore(SQLBaseStore):
table="profiles", table="profiles",
keyvalues={"user_id": user_localpart}, keyvalues={"user_id": user_localpart},
retcol="displayname", retcol="displayname",
desc="get_profile_displayname",
) )
def set_profile_displayname(self, user_localpart, new_displayname): def set_profile_displayname(self, user_localpart, new_displayname):
@ -35,6 +37,7 @@ class ProfileStore(SQLBaseStore):
table="profiles", table="profiles",
keyvalues={"user_id": user_localpart}, keyvalues={"user_id": user_localpart},
updatevalues={"displayname": new_displayname}, updatevalues={"displayname": new_displayname},
desc="set_profile_displayname",
) )
def get_profile_avatar_url(self, user_localpart): def get_profile_avatar_url(self, user_localpart):
@ -42,6 +45,7 @@ class ProfileStore(SQLBaseStore):
table="profiles", table="profiles",
keyvalues={"user_id": user_localpart}, keyvalues={"user_id": user_localpart},
retcol="avatar_url", retcol="avatar_url",
desc="get_profile_avatar_url",
) )
def set_profile_avatar_url(self, user_localpart, new_avatar_url): def set_profile_avatar_url(self, user_localpart, new_avatar_url):
@ -49,4 +53,5 @@ class ProfileStore(SQLBaseStore):
table="profiles", table="profiles",
keyvalues={"user_id": user_localpart}, keyvalues={"user_id": user_localpart},
updatevalues={"avatar_url": new_avatar_url}, updatevalues={"avatar_url": new_avatar_url},
desc="set_profile_avatar_url",
) )

View File

@ -50,7 +50,8 @@ class PushRuleStore(SQLBaseStore):
results = yield self._simple_select_list( results = yield self._simple_select_list(
PushRuleEnableTable.table_name, PushRuleEnableTable.table_name,
{'user_name': user_name}, {'user_name': user_name},
PushRuleEnableTable.fields PushRuleEnableTable.fields,
desc="get_push_rules_enabled_for_user",
) )
defer.returnValue( defer.returnValue(
{r['rule_id']: False if r['enabled'] == 0 else True for r in results} {r['rule_id']: False if r['enabled'] == 0 else True for r in results}
@ -201,7 +202,8 @@ class PushRuleStore(SQLBaseStore):
""" """
yield self._simple_delete_one( yield self._simple_delete_one(
PushRuleTable.table_name, PushRuleTable.table_name,
{'user_name': user_name, 'rule_id': rule_id} {'user_name': user_name, 'rule_id': rule_id},
desc="delete_push_rule",
) )
@defer.inlineCallbacks @defer.inlineCallbacks
@ -209,7 +211,8 @@ class PushRuleStore(SQLBaseStore):
yield self._simple_upsert( yield self._simple_upsert(
PushRuleEnableTable.table_name, PushRuleEnableTable.table_name,
{'user_name': user_name, 'rule_id': rule_id}, {'user_name': user_name, 'rule_id': rule_id},
{'enabled': enabled} {'enabled': enabled},
desc="set_push_rule_enabled",
) )

View File

@ -114,7 +114,9 @@ class PusherStore(SQLBaseStore):
ts=pushkey_ts, ts=pushkey_ts,
lang=lang, lang=lang,
data=data data=data
)) ),
desc="add_pusher",
)
except Exception as e: except Exception as e:
logger.error("create_pusher with failed: %s", e) logger.error("create_pusher with failed: %s", e)
raise StoreError(500, "Problem creating pusher.") raise StoreError(500, "Problem creating pusher.")
@ -123,7 +125,8 @@ class PusherStore(SQLBaseStore):
def delete_pusher_by_app_id_pushkey(self, app_id, pushkey): def delete_pusher_by_app_id_pushkey(self, app_id, pushkey):
yield self._simple_delete_one( yield self._simple_delete_one(
PushersTable.table_name, PushersTable.table_name,
dict(app_id=app_id, pushkey=pushkey) {"app_id": app_id, "pushkey": pushkey},
desc="delete_pusher_by_app_id_pushkey",
) )
@defer.inlineCallbacks @defer.inlineCallbacks
@ -131,7 +134,8 @@ class PusherStore(SQLBaseStore):
yield self._simple_update_one( yield self._simple_update_one(
PushersTable.table_name, PushersTable.table_name,
{'app_id': app_id, 'pushkey': pushkey}, {'app_id': app_id, 'pushkey': pushkey},
{'last_token': last_token} {'last_token': last_token},
desc="update_pusher_last_token",
) )
@defer.inlineCallbacks @defer.inlineCallbacks
@ -140,7 +144,8 @@ class PusherStore(SQLBaseStore):
yield self._simple_update_one( yield self._simple_update_one(
PushersTable.table_name, PushersTable.table_name,
{'app_id': app_id, 'pushkey': pushkey}, {'app_id': app_id, 'pushkey': pushkey},
{'last_token': last_token, 'last_success': last_success} {'last_token': last_token, 'last_success': last_success},
desc="update_pusher_last_token_and_success",
) )
@defer.inlineCallbacks @defer.inlineCallbacks
@ -148,7 +153,8 @@ class PusherStore(SQLBaseStore):
yield self._simple_update_one( yield self._simple_update_one(
PushersTable.table_name, PushersTable.table_name,
{'app_id': app_id, 'pushkey': pushkey}, {'app_id': app_id, 'pushkey': pushkey},
{'failing_since': failing_since} {'failing_since': failing_since},
desc="update_pusher_failing_since",
) )

View File

@ -39,7 +39,10 @@ class RegistrationStore(SQLBaseStore):
Raises: Raises:
StoreError if there was a problem adding this. StoreError if there was a problem adding this.
""" """
row = yield self._simple_select_one("users", {"name": user_id}, ["id"]) row = yield self._simple_select_one(
"users", {"name": user_id}, ["id"],
desc="add_access_token_to_user",
)
if not row: if not row:
raise StoreError(400, "Bad user ID supplied.") raise StoreError(400, "Bad user ID supplied.")
row_id = row["id"] row_id = row["id"]
@ -48,7 +51,8 @@ class RegistrationStore(SQLBaseStore):
{ {
"user_id": row_id, "user_id": row_id,
"token": token "token": token
} },
desc="add_access_token_to_user",
) )
@defer.inlineCallbacks @defer.inlineCallbacks
@ -120,6 +124,7 @@ class RegistrationStore(SQLBaseStore):
keyvalues={"name": user.to_string()}, keyvalues={"name": user.to_string()},
retcol="admin", retcol="admin",
allow_none=True, allow_none=True,
desc="is_server_admin",
) )
defer.returnValue(res if res else False) defer.returnValue(res if res else False)

View File

@ -29,7 +29,7 @@ class RejectionsStore(SQLBaseStore):
"event_id": event_id, "event_id": event_id,
"reason": reason, "reason": reason,
"last_check": self._clock.time_msec(), "last_check": self._clock.time_msec(),
} },
) )
def get_rejection_reason(self, event_id): def get_rejection_reason(self, event_id):
@ -40,4 +40,5 @@ class RejectionsStore(SQLBaseStore):
"event_id": event_id, "event_id": event_id,
}, },
allow_none=True, allow_none=True,
desc="get_rejection_reason",
) )

View File

@ -52,7 +52,8 @@ class RoomStore(SQLBaseStore):
"room_id": room_id, "room_id": room_id,
"creator": room_creator_user_id, "creator": room_creator_user_id,
"is_public": is_public, "is_public": is_public,
} },
desc="store_room",
) )
except Exception as e: except Exception as e:
logger.error("store_room with room_id=%s failed: %s", room_id, e) logger.error("store_room with room_id=%s failed: %s", room_id, e)
@ -70,6 +71,7 @@ class RoomStore(SQLBaseStore):
table=RoomsTable.table_name, table=RoomsTable.table_name,
keyvalues={"room_id": room_id}, keyvalues={"room_id": room_id},
retcols=RoomsTable.fields, retcols=RoomsTable.fields,
desc="get_room",
) )
@defer.inlineCallbacks @defer.inlineCallbacks
@ -144,7 +146,7 @@ class RoomStore(SQLBaseStore):
"event_id": event.event_id, "event_id": event.event_id,
"room_id": event.room_id, "room_id": event.room_id,
"topic": event.content["topic"], "topic": event.content["topic"],
} },
) )
def _store_room_name_txn(self, txn, event): def _store_room_name_txn(self, txn, event):

View File

@ -212,7 +212,8 @@ class RoomMemberStore(SQLBaseStore):
return self._simple_select_onecol( return self._simple_select_onecol(
"room_hosts", "room_hosts",
{"room_id": room_id}, {"room_id": room_id},
"host" "host",
desc="get_joined_hosts_for_room",
) )
def _get_members_by_dict(self, where_dict): def _get_members_by_dict(self, where_dict):