Merge pull request #47 from matrix-org/erikj/fallback_to_created_ts

Fix upload script to handle media that has never been accessed
This commit is contained in:
Erik Johnston 2020-10-28 10:02:05 +00:00 committed by GitHub
commit d58c93d7ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,7 +63,7 @@ def run_update_db(postgres_conn, sqlite_conn, before_date):
SELECT '', media_id, media_id
FROM local_media_repository
WHERE
last_access_ts < %s
COALESCE(last_access_ts, created_ts) < %s
AND url_cache IS NULL
"""
@ -71,7 +71,7 @@ def run_update_db(postgres_conn, sqlite_conn, before_date):
SELECT media_origin, media_id, filesystem_id
FROM remote_media_cache
WHERE
last_access_ts < %s
COALESCE(last_access_ts, created_ts) < %s
"""
last_access_ts = int(before_date.timestamp() * 1000)