Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #6470 from matrix-org/babolivier/port_db_ci_failure
Browse files Browse the repository at this point in the history
* commit 'fe799f353':
  Fix background updates for synapse_port_db
  Changelog
  Make synapse_port_db exit with a non-0 code if something failed
  • Loading branch information
anoadragon453 committed Mar 19, 2020
2 parents 92d6b6c + fe799f3 commit f6c28ac
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.d/6470.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix `synapse_port_db` not exiting with a 0 code if something went wrong during the port process.
3 changes: 3 additions & 0 deletions scripts/synapse_port_db
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ from synapse.storage.data_stores.main.media_repository import (
from synapse.storage.data_stores.main.registration import (
RegistrationBackgroundUpdateStore,
)
from synapse.storage.data_stores.main.room import RoomBackgroundUpdateStore
from synapse.storage.data_stores.main.roommember import RoomMemberBackgroundUpdateStore
from synapse.storage.data_stores.main.search import SearchBackgroundUpdateStore
from synapse.storage.data_stores.main.state import StateBackgroundUpdateStore
Expand Down Expand Up @@ -131,6 +132,7 @@ class Store(
EventsBackgroundUpdatesStore,
MediaRepositoryBackgroundUpdateStore,
RegistrationBackgroundUpdateStore,
RoomBackgroundUpdateStore,
RoomMemberBackgroundUpdateStore,
SearchBackgroundUpdateStore,
StateBackgroundUpdateStore,
Expand Down Expand Up @@ -1055,3 +1057,4 @@ if __name__ == "__main__":
if end_error_exec_info:
exc_type, exc_value, exc_traceback = end_error_exec_info
traceback.print_exception(exc_type, exc_value, exc_traceback)
sys.exit(5)
12 changes: 10 additions & 2 deletions synapse/storage/data_stores/main/room.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from synapse.api.constants import EventTypes
from synapse.api.errors import StoreError
from synapse.storage._base import SQLBaseStore
from synapse.storage.background_updates import BackgroundUpdateStore
from synapse.storage.data_stores.main.search import SearchStore
from synapse.types import ThirdPartyInstanceID
from synapse.util.caches.descriptors import cached, cachedInlineCallbacks
Expand Down Expand Up @@ -383,9 +384,9 @@ def get_retention_policy_for_room_txn(txn):
defer.returnValue(row)


class RoomStore(RoomWorkerStore, SearchStore):
class RoomBackgroundUpdateStore(BackgroundUpdateStore):
def __init__(self, db_conn, hs):
super(RoomStore, self).__init__(db_conn, hs)
super(RoomBackgroundUpdateStore, self).__init__(db_conn, hs)

self.config = hs.config

Expand Down Expand Up @@ -461,6 +462,13 @@ def _background_insert_retention_txn(txn):

defer.returnValue(batch_size)


class RoomStore(RoomBackgroundUpdateStore, RoomWorkerStore, SearchStore):
def __init__(self, db_conn, hs):
super(RoomStore, self).__init__(db_conn, hs)

self.config = hs.config

@defer.inlineCallbacks
def store_room(self, room_id, room_creator_user_id, is_public):
"""Stores a room.
Expand Down

0 comments on commit f6c28ac

Please sign in to comment.