

@task(queue='background_queue', ignore_result=True, acks_late=True)
def delete_reminders_for_cases(domain, case_ids):
    handler_ids = CaseReminderHandler.get_handler_ids(domain, reminder_type_filter=REMINDER_TYPE_DEFAULT)
    for ids in chunked(case_ids, 50):
        keys = [[domain, handler_id, case_id] for handler_id in handler_ids for case_id in ids]
        results = CaseReminder.get_db().view('reminders/by_domain_handler_case', keys=keys, include_docs=True)
        soft_delete_docs([row['doc'] for row in results], CaseReminder)

dataset/ETHPy150Open dimagi/commcare-hq/corehq/apps/reminders/tasks.py delete_reminders_for_cases/original