diff options
author | Erik Johnston <erik@matrix.org> | 2014-08-19 14:20:03 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-08-19 14:20:03 +0100 |
commit | 75b6d982a01a431a89d2ab76d91a09159630d059 (patch) | |
tree | fbcaf076fba353d05f757180ab19f7ea823c37e4 /synapse/storage/pdu.py | |
parent | Change the way pagination works to support out of order events. (diff) | |
download | synapse-75b6d982a01a431a89d2ab76d91a09159630d059.tar.xz |
Add a 'backfill room' button
Diffstat (limited to '')
-rw-r--r-- | synapse/storage/pdu.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/synapse/storage/pdu.py b/synapse/storage/pdu.py index a24ce7ab78..7655f43ede 100644 --- a/synapse/storage/pdu.py +++ b/synapse/storage/pdu.py @@ -13,6 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from twisted.internet import defer + from ._base import SQLBaseStore, Table, JoinHelper from synapse.util.logutils import log_function @@ -319,6 +321,7 @@ class PduStore(SQLBaseStore): return [(row[0], row[1], row[2]) for row in results] + @defer.inlineCallbacks def get_oldest_pdus_in_context(self, context): """Get a list of Pdus that we haven't backfilled beyond yet (and haven't seen). This list is used when we want to backfill backwards and is the @@ -331,17 +334,14 @@ class PduStore(SQLBaseStore): Returns: list: A list of PduIdTuple. """ - return self._db_pool.runInteraction( - self._get_oldest_pdus_in_context, context - ) - - def _get_oldest_pdus_in_context(self, txn, context): - txn.execute( + results = yield self._execute( + None, "SELECT pdu_id, origin FROM %(back)s WHERE context = ?" % {"back": PduBackwardExtremitiesTable.table_name, }, - (context,) + context ) - return [PduIdTuple(i, o) for i, o in txn.fetchall()] + + defer.returnValue([PduIdTuple(i, o) for i, o in results]) def is_pdu_new(self, pdu_id, origin, context, depth): """For a given Pdu, try and figure out if it's 'new', i.e., if it's |