import_realm: Add progress indicator for importing uploads.

This makes it easier to see how we're doing when uploading a very
large number of files.
This commit is contained in:
Tim Abbott 2018-12-05 15:24:42 -08:00
parent 9e06ab45bf
commit f80bab58c0
1 changed files with 10 additions and 0 deletions

View File

@ -527,7 +527,12 @@ def import_uploads_local(import_dir: Path, processing_avatars: bool=False,
if not processing_emojis:
re_map_foreign_keys_internal(records, 'records', 'user_profile_id',
related_table="user_profile", id_field=True)
count = 0
for record in records:
count += 1
if count % 1000 == 0:
logging.info("Processed %s/%s uploads" % (count, len(records)))
if processing_avatars:
# For avatars, we need to rehash the user ID with the
# new server's avatar salt
@ -594,9 +599,14 @@ def import_uploads_s3(bucket_name: str, import_dir: Path, processing_avatars: bo
if not processing_emojis:
re_map_foreign_keys_internal(records, 'records', 'user_profile_id',
related_table="user_profile", id_field=True)
count = 0
for record in records:
key = Key(bucket)
count += 1
if count % 1000 == 0:
logging.info("Processed %s/%s uploads" % (count, len(records)))
if processing_avatars:
# For avatars, we need to rehash the user's email with the
# new server's avatar salt