mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-27 20:22:07 +03:00
Fix port script tests by handling empty DBs correctly
This commit is contained in:
parent
ab414f2ab8
commit
90d0e035dd
1 changed files with 12 additions and 0 deletions
|
@ -2323,6 +2323,12 @@ def _resolve_stale_data_in_sliding_sync_joined_rooms_table(
|
||||||
value_values=[() for x in range(len(chunk))],
|
value_values=[() for x in range(len(chunk))],
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
txn.execute("SELECT 1 FROM local_current_membership LIMIT 1")
|
||||||
|
row = txn.fetchone()
|
||||||
|
if row is None:
|
||||||
|
# There are no rooms, so don't schedule the bg update.
|
||||||
|
return
|
||||||
|
|
||||||
# Re-run the `sliding_sync_joined_rooms_to_recalculate` prefill if there is
|
# Re-run the `sliding_sync_joined_rooms_to_recalculate` prefill if there is
|
||||||
# nothing in the `sliding_sync_joined_rooms` table
|
# nothing in the `sliding_sync_joined_rooms` table
|
||||||
DatabasePool.simple_upsert_txn_native_upsert(
|
DatabasePool.simple_upsert_txn_native_upsert(
|
||||||
|
@ -2430,6 +2436,12 @@ def _resolve_stale_data_in_sliding_sync_membership_snapshots_table(
|
||||||
keys=("user_id", "room_id"),
|
keys=("user_id", "room_id"),
|
||||||
values=chunk,
|
values=chunk,
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
txn.execute("SELECT 1 FROM local_current_membership LIMIT 1")
|
||||||
|
row = txn.fetchone()
|
||||||
|
if row is None:
|
||||||
|
# There are no rooms, so don't schedule the bg update.
|
||||||
|
return
|
||||||
|
|
||||||
# Now kick-off the background update to catch-up with what we missed while Synapse
|
# Now kick-off the background update to catch-up with what we missed while Synapse
|
||||||
# was downgraded.
|
# was downgraded.
|
||||||
|
|
Loading…
Reference in a new issue