Fixed slow import when duplicates
This commit is contained in:
parent
f43f029a18
commit
f400d2568b
|
@ -251,6 +251,10 @@ def process_upload(upload, update_denormalization=True):
|
||||||
fail_import(upload, "unknown_error")
|
fail_import(upload, "unknown_error")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
broadcast = getter(
|
||||||
|
internal_config, "funkwhale", "config", "broadcast", default=True
|
||||||
|
)
|
||||||
|
|
||||||
# under some situations, we want to skip the import (
|
# under some situations, we want to skip the import (
|
||||||
# for instance if the user already owns the files)
|
# for instance if the user already owns the files)
|
||||||
owned_duplicates = get_owned_duplicates(upload, track)
|
owned_duplicates = get_owned_duplicates(upload, track)
|
||||||
|
@ -266,12 +270,13 @@ def process_upload(upload, update_denormalization=True):
|
||||||
upload.save(
|
upload.save(
|
||||||
update_fields=["import_details", "import_status", "import_date", "track"]
|
update_fields=["import_details", "import_status", "import_date", "track"]
|
||||||
)
|
)
|
||||||
signals.upload_import_status_updated.send(
|
if broadcast:
|
||||||
old_status=old_status,
|
signals.upload_import_status_updated.send(
|
||||||
new_status=upload.import_status,
|
old_status=old_status,
|
||||||
upload=upload,
|
new_status=upload.import_status,
|
||||||
sender=None,
|
upload=upload,
|
||||||
)
|
sender=None,
|
||||||
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
# all is good, let's finalize the import
|
# all is good, let's finalize the import
|
||||||
|
@ -308,9 +313,6 @@ def process_upload(upload, update_denormalization=True):
|
||||||
track.album, source=final_metadata.get("upload_source"),
|
track.album, source=final_metadata.get("upload_source"),
|
||||||
)
|
)
|
||||||
|
|
||||||
broadcast = getter(
|
|
||||||
internal_config, "funkwhale", "config", "broadcast", default=True
|
|
||||||
)
|
|
||||||
if broadcast:
|
if broadcast:
|
||||||
signals.upload_import_status_updated.send(
|
signals.upload_import_status_updated.send(
|
||||||
old_status=old_status,
|
old_status=old_status,
|
||||||
|
|
Loading…
Reference in New Issue