Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get summary without feature flag #837

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/task_queue/database_tasks/media_library_cleanup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
)
from api.store.media_library import MediaLibraryStore as media_store
from api.utils.constants import MEDIA_LIBRARY_CLEANUP_TEMPLATE
from database.models import FeatureFlag
from database.models import Community, FeatureFlag
from task_queue.models import Task


REMOVE_DUPLICATE_IMAGE_FLAG_KEY = "remove-duplicate-images-feature-flag"


def remove_duplicate_images(task):
def remove_duplicate_images(task=None):
"""
This checks all media on the platform and removes all duplicates.
Its based on the "Remove Duplicate Images" feature flag. For communities that are subscribed
Expand All @@ -33,7 +33,10 @@ def remove_duplicate_images(task):
print("Generating hashes")
result = media_store.generate_hashes(None, None, None)

communities = flag.enabled_communities()
if flag and do_updates:
communities = flag.enabled_communities()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if the flag is enabled, but no communities selected, this will produce an empty queryset and it will not do any reporting on duplicates, but probably blow up.

else:
communities = Community.objects.all()
# task = Task.objects.filter(name="Media Library Cleanup Routine").first()
ids = [c.id for c in communities]
clean_and_notify(ids,None,task.creator, do_updates)
Expand Down
Loading