Mark recorder system_health session read_only (#89842)

This commit is contained in:
J. Nick Koston 2023-03-16 23:22:21 -10:00 committed by GitHub
parent ab4a726e6c
commit aa72b48725
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -33,7 +33,7 @@ def async_register(
def _get_db_stats(instance: Recorder, database_name: str) -> dict[str, Any]:
"""Get the stats about the database."""
db_stats: dict[str, Any] = {}
with session_scope(session=instance.get_session()) as session:
with session_scope(session=instance.get_session(), read_only=True) as session:
if (
(dialect_name := instance.dialect_name)
and (get_size := DIALECT_TO_GET_SIZE.get(dialect_name))