mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-11-28 12:20:25 -05:00
Track approximate last access time for remote media
This commit is contained in:
parent
7846ac3125
commit
314b146b2e
4 changed files with 71 additions and 1 deletions
|
|
@ -157,10 +157,25 @@ class MediaRepositoryStore(SQLBaseStore):
|
|||
"created_ts": time_now_ms,
|
||||
"upload_name": upload_name,
|
||||
"filesystem_id": filesystem_id,
|
||||
"last_access_ts": time_now_ms,
|
||||
},
|
||||
desc="store_cached_remote_media",
|
||||
)
|
||||
|
||||
def update_cached_last_access_time(self, origin_id_tuples, time_ts):
|
||||
def update_cache_txn(txn):
|
||||
sql = (
|
||||
"UPDATE remote_media_cache SET last_access_ts = ?"
|
||||
" WHERE media_origin = ? AND media_id = ?"
|
||||
)
|
||||
|
||||
txn.executemany(sql, (
|
||||
(time_ts, media_origin, media_id)
|
||||
for media_origin, media_id in origin_id_tuples
|
||||
))
|
||||
|
||||
return self.runInteraction("update_cached_last_access_time", update_cache_txn)
|
||||
|
||||
def get_remote_media_thumbnails(self, origin, media_id):
|
||||
return self._simple_select_list(
|
||||
"remote_media_cache_thumbnails",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue