mirror of
https://mau.dev/maunium/synapse.git
synced 2024-08-21 17:55:37 +00:00
Back to using cursor_to_dict
This commit is contained in:
parent
ec2cb9f298
commit
1186612d6c
@ -525,10 +525,13 @@ class EventsBackgroundUpdatesStore(BackgroundUpdateStore):
|
|||||||
(last_event_id, batch_size),
|
(last_event_id, batch_size),
|
||||||
)
|
)
|
||||||
|
|
||||||
nbrows = 0
|
rows = self.cursor_to_dict(txn)
|
||||||
last_row_event_id = ""
|
if not len(rows):
|
||||||
for (event_id, event_json_raw) in txn:
|
return 0
|
||||||
event_json = json.loads(event_json_raw)
|
|
||||||
|
for row in rows:
|
||||||
|
event_id = row["event_id"]
|
||||||
|
event_json = json.loads(row["event_json"])
|
||||||
|
|
||||||
self._simple_insert_many_txn(
|
self._simple_insert_many_txn(
|
||||||
txn=txn,
|
txn=txn,
|
||||||
@ -547,14 +550,11 @@ class EventsBackgroundUpdatesStore(BackgroundUpdateStore):
|
|||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
nbrows += 1
|
|
||||||
last_row_event_id = event_id
|
|
||||||
|
|
||||||
self._background_update_progress_txn(
|
self._background_update_progress_txn(
|
||||||
txn, "event_store_labels", {"last_event_id": last_row_event_id}
|
txn, "event_store_labels", {"last_event_id": event_id}
|
||||||
)
|
)
|
||||||
|
|
||||||
return nbrows
|
return len(rows)
|
||||||
|
|
||||||
num_rows = yield self.runInteraction(
|
num_rows = yield self.runInteraction(
|
||||||
desc="event_store_labels", func=_event_store_labels_txn
|
desc="event_store_labels", func=_event_store_labels_txn
|
||||||
|
Loading…
Reference in New Issue
Block a user