Add flag to enable alchemysession core mode

This commit is contained in:
Tulir Asokan
2018-10-20 14:46:26 +03:00
parent 247c75191b
commit f8c844c4c0
3 changed files with 9 additions and 0 deletions
+3
View File
@@ -27,6 +27,9 @@ appservice:
# SQLite: sqlite:///filename.db
# Postgres: postgres://username:password@hostname/dbname
database: sqlite:///mautrix-telegram.db
# Whether or not to use SQLAlchemy Core for common database actions. Use if the bridge is
# being bottlenecked on ORM commits. Only supported with PostgreSQL.
sqlalchemy_core_mode: false
# Public part of web server for out-of-Matrix interaction with the bridge.
# Used for things like login if the user wants to make sure the 2FA password isn't stored in
+5
View File
@@ -79,6 +79,11 @@ Base.metadata.bind = db_engine
session_container = AlchemySessionContainer(engine=db_engine, session=db_session,
table_base=Base, table_prefix="telethon_",
manage_tables=False)
if config["appservice.sqlalchemy_core_mode"]:
try:
session_container.core_mode = True
except AttributeError:
log.error("Current version of teleton-session-sqlalchemy does not support core mode")
loop = asyncio.get_event_loop() # type: asyncio.AbstractEventLoop
+1
View File
@@ -165,6 +165,7 @@ class Config(DictWithRecursion):
copy("appservice.max_body_size")
copy("appservice.database")
copy("appservice.sqlalchemy_core_mode")
copy("appservice.public.enabled")
copy("appservice.public.prefix")