Skip to content

Commit 2d62462

Browse files
committed
Don't check for quarantined hashes if the index is not created yet
1 parent ab5e7da commit 2d62462

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

synapse/storage/databases/main/media_repository.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -999,6 +999,15 @@ async def get_is_hash_quarantined(self, sha256: str) -> bool:
999999
None if the media_id doesn't exist.
10001000
"""
10011001

1002+
# If we don't have the index yet, performance tanks, so we return False.
1003+
# In the background updates, remote_media_cache_sha256_idx is created
1004+
# after local_media_repository_sha256_idx, which is why we only need to
1005+
# check for the completion of the former.
1006+
if not await self.db_pool.updates.has_completed_background_update(
1007+
"remote_media_cache_sha256_idx"
1008+
):
1009+
return False
1010+
10021011
def get_matching_media_txn(
10031012
txn: LoggingTransaction, table: str, sha256: str
10041013
) -> bool:

0 commit comments

Comments
 (0)