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

Commit

Permalink
fixup! media/create: enforce limit on number of pending uploads
Browse files Browse the repository at this point in the history
Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
  • Loading branch information
sumnerevans and clokep authored Nov 13, 2023
1 parent 1cff556 commit 07afcfb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions synapse/storage/databases/main/media_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,10 +483,10 @@ async def count_pending_media(self, user_id: UserID) -> Tuple[int, int]:

def get_pending_media_txn(txn: LoggingTransaction) -> Tuple[int, int]:
sql = """
SELECT COUNT(*), MIN(created_at)
SELECT COUNT(*), MIN(created_ts)
FROM local_media_repository
WHERE user_id = ?
AND created_at > ?
AND created_ts > ?
AND media_length IS NULL
"""
txn.execute(
Expand All @@ -501,7 +501,7 @@ def get_pending_media_txn(txn: LoggingTransaction) -> Tuple[int, int]:
return 0, 0
return row[0], (row[1] + self.unused_expiration_time if row[1] else 0)

return await self.db_pool.runInteraction("get_url_cache", get_pending_media_txn)
return await self.db_pool.runInteraction("get_pending_media", get_pending_media_txn)

async def get_url_cache(self, url: str, ts: int) -> Optional[UrlCache]:
"""Get the media_id and ts for a cached URL as of the given timestamp
Expand Down

0 comments on commit 07afcfb

Please sign in to comment.