diff options
author | Erik Johnston <erik@matrix.org> | 2016-09-23 15:31:47 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2016-09-23 16:49:21 +0100 |
commit | 748d8fdc7bcdb43719e99a48cc74bf078f22396f (patch) | |
tree | 19ea8ddc1692448cb2818ecd42b5512014e12caa /synapse/storage/room.py | |
parent | Merge pull request #1136 from matrix-org/erikj/fix_signed_3pid (diff) | |
download | synapse-748d8fdc7bcdb43719e99a48cc74bf078f22396f.tar.xz |
Reduce DB hits for replication
Some streams will occaisonally advance their positions without actually having any new rows to send over federation. Currently this means that the token will not advance on the workers, leading to them repeatedly sending a slightly out of date token. This in turns requires the master to hit the DB to check if there are any new rows, rather than hitting the no op logic where we check if the given token matches the current token. This commit changes the API to always return an entry if the position for a stream has changed, allowing workers to advance their tokens correctly.
Diffstat (limited to 'synapse/storage/room.py')
-rw-r--r-- | synapse/storage/room.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/synapse/storage/room.py b/synapse/storage/room.py index 2ef13d7403..11813b44f6 100644 --- a/synapse/storage/room.py +++ b/synapse/storage/room.py @@ -320,6 +320,9 @@ class RoomStore(SQLBaseStore): txn.execute(sql, (prev_id, current_id, limit,)) return txn.fetchall() + if prev_id == current_id: + return defer.succeed([]) + return self.runInteraction( "get_all_new_public_rooms", get_all_new_public_rooms ) |