fix flakes

This commit is contained in:
Matthew Hodgson 2017-12-27 23:58:51 +00:00 committed by Hubert Chathi
parent 234611f347
commit 982edca380
2 changed files with 6 additions and 4 deletions

View File

@ -136,7 +136,7 @@ class E2eRoomKeysHandler(object):
"""Upload a given room_key for a given room and session into a given """Upload a given room_key for a given room and session into a given
version of the backup. Merges the key with any which might already exist. version of the backup. Merges the key with any which might already exist.
Args: Args:
user_id(str): the user whose backup we're setting user_id(str): the user whose backup we're setting
version(str): the version ID of the backup we're updating version(str): the version ID of the backup we're updating
room_id(str): the ID of the room whose keys we're setting room_id(str): the ID of the room whose keys we're setting
@ -199,7 +199,7 @@ class E2eRoomKeysHandler(object):
backup version for the user's keys; previous backups will no longer be backup version for the user's keys; previous backups will no longer be
writeable to. writeable to.
Args: Args:
user_id(str): the user whose backup version we're creating user_id(str): the user whose backup version we're creating
version_info(dict): metadata about the new version being created version_info(dict): metadata about the new version being created

View File

@ -202,13 +202,15 @@ class EndToEndRoomKeyStore(SQLBaseStore):
"SELECT MAX(version) FROM e2e_room_keys_versions WHERE user_id=?", "SELECT MAX(version) FROM e2e_room_keys_versions WHERE user_id=?",
(user_id,) (user_id,)
) )
version = txn.fetchone()[0] this_version = txn.fetchone()[0]
else:
this_version = version
return self._simple_select_one_txn( return self._simple_select_one_txn(
table="e2e_room_keys_versions", table="e2e_room_keys_versions",
keyvalues={ keyvalues={
"user_id": user_id, "user_id": user_id,
"version": version, "version": this_version,
}, },
retcols=( retcols=(
"user_id", "user_id",