mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-18 17:10:43 +03:00
Fix sliding sync on workers (#17649)
Broke in #17630 --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
This commit is contained in:
parent
fc10d38849
commit
dce38f3faf
3 changed files with 13 additions and 11 deletions
1
changelog.d/17649.misc
Normal file
1
changelog.d/17649.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Use new database tables for sliding sync.
|
|
@ -2342,17 +2342,6 @@ class EventsBackgroundUpdatesStore(StreamWorkerStore, StateDeltasStore, SQLBaseS
|
||||||
|
|
||||||
return len(memberships_to_update_rows)
|
return len(memberships_to_update_rows)
|
||||||
|
|
||||||
async def have_finished_sliding_sync_background_jobs(self) -> bool:
|
|
||||||
"""Return if its safe to use the sliding sync membership tables."""
|
|
||||||
|
|
||||||
return await self.db_pool.updates.have_completed_background_updates(
|
|
||||||
(
|
|
||||||
_BackgroundUpdates.SLIDING_SYNC_PREFILL_JOINED_ROOMS_TO_RECALCULATE_TABLE_BG_UPDATE,
|
|
||||||
_BackgroundUpdates.SLIDING_SYNC_JOINED_ROOMS_BG_UPDATE,
|
|
||||||
_BackgroundUpdates.SLIDING_SYNC_MEMBERSHIP_SNAPSHOTS_BG_UPDATE,
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _resolve_stale_data_in_sliding_sync_tables(
|
def _resolve_stale_data_in_sliding_sync_tables(
|
||||||
txn: LoggingTransaction,
|
txn: LoggingTransaction,
|
||||||
|
|
|
@ -51,6 +51,7 @@ from synapse.storage.database import (
|
||||||
LoggingTransaction,
|
LoggingTransaction,
|
||||||
)
|
)
|
||||||
from synapse.storage.databases.main.cache import CacheInvalidationWorkerStore
|
from synapse.storage.databases.main.cache import CacheInvalidationWorkerStore
|
||||||
|
from synapse.storage.databases.main.events_bg_updates import _BackgroundUpdates
|
||||||
from synapse.storage.databases.main.events_worker import EventsWorkerStore
|
from synapse.storage.databases.main.events_worker import EventsWorkerStore
|
||||||
from synapse.storage.engines import Sqlite3Engine
|
from synapse.storage.engines import Sqlite3Engine
|
||||||
from synapse.storage.roommember import (
|
from synapse.storage.roommember import (
|
||||||
|
@ -1424,6 +1425,17 @@ class RoomMemberWorkerStore(EventsWorkerStore, CacheInvalidationWorkerStore):
|
||||||
get_sliding_sync_rooms_for_user_txn,
|
get_sliding_sync_rooms_for_user_txn,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def have_finished_sliding_sync_background_jobs(self) -> bool:
|
||||||
|
"""Return if it's safe to use the sliding sync membership tables."""
|
||||||
|
|
||||||
|
return await self.db_pool.updates.have_completed_background_updates(
|
||||||
|
(
|
||||||
|
_BackgroundUpdates.SLIDING_SYNC_PREFILL_JOINED_ROOMS_TO_RECALCULATE_TABLE_BG_UPDATE,
|
||||||
|
_BackgroundUpdates.SLIDING_SYNC_JOINED_ROOMS_BG_UPDATE,
|
||||||
|
_BackgroundUpdates.SLIDING_SYNC_MEMBERSHIP_SNAPSHOTS_BG_UPDATE,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class RoomMemberBackgroundUpdateStore(SQLBaseStore):
|
class RoomMemberBackgroundUpdateStore(SQLBaseStore):
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
Loading…
Reference in a new issue