From 8debbdf5c158c7d593c2ed104518e563cef40350 Mon Sep 17 00:00:00 2001 From: Patrick Cloke Date: Wed, 15 Nov 2023 08:23:15 -0500 Subject: [PATCH] Fix reference to potentially undefined config. --- synapse/storage/databases/main/media_repository.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/synapse/storage/databases/main/media_repository.py b/synapse/storage/databases/main/media_repository.py index c5121e323862..c55d58bdbd49 100644 --- a/synapse/storage/databases/main/media_repository.py +++ b/synapse/storage/databases/main/media_repository.py @@ -150,7 +150,10 @@ def __init__( self._drop_media_index_without_method, ) - self.unused_expiration_time = hs.config.media.unused_expiration_time + if hs.config.media.can_load_media_repo: + self.unused_expiration_time = hs.config.media.unused_expiration_time + else: + self.unused_expiration_time = None async def _drop_media_index_without_method( self, progress: JsonDict, batch_size: int @@ -489,6 +492,7 @@ def get_pending_media_txn(txn: LoggingTransaction) -> Tuple[int, int]: AND created_ts > ? AND media_length IS NULL """ + assert self.unused_expiration_time is not None txn.execute( sql, (