Always pass stores to remove_object_from_related_stores

This commit is contained in:
Wesley Aptekar-Cassels 2023-04-05 20:50:02 -04:00
parent 93bd66ad3e
commit 8053f49acc
2 changed files with 9 additions and 3 deletions

View file

@ -516,7 +516,9 @@ def remove_status_task(status_ids):
for stream in streams.values(): for stream in streams.values():
for status in statuses: for status in statuses:
stream.remove_object_from_related_stores(status) stream.remove_object_from_related_stores(
status, stores=stream.get_stores_for_object(status)
)
@app.task(queue=HIGH, ignore_result=True) @app.task(queue=HIGH, ignore_result=True)

View file

@ -254,7 +254,9 @@ def rerank_user_task(user_id, update_only=False):
def remove_user_task(user_id): def remove_user_task(user_id):
"""do the hard work in celery""" """do the hard work in celery"""
user = models.User.objects.get(id=user_id) user = models.User.objects.get(id=user_id)
suggested_users.remove_object_from_related_stores(user) suggested_users.remove_object_from_related_stores(
user, stores=suggested_users.get_stores_for_object(user)
)
@app.task(queue=MEDIUM, ignore_result=True) @app.task(queue=MEDIUM, ignore_result=True)
@ -268,7 +270,9 @@ def remove_suggestion_task(user_id, suggested_user_id):
def bulk_remove_instance_task(instance_id): def bulk_remove_instance_task(instance_id):
"""remove a bunch of users from recs""" """remove a bunch of users from recs"""
for user in models.User.objects.filter(federated_server__id=instance_id): for user in models.User.objects.filter(federated_server__id=instance_id):
suggested_users.remove_object_from_related_stores(user) suggested_users.remove_object_from_related_stores(
user, stores=suggested_users.get_stores_for_object(user)
)
@app.task(queue=LOW, ignore_result=True) @app.task(queue=LOW, ignore_result=True)