(user_id, domain, form_id_list, deletion_id,
                                                  deletion_date, deleted_cases=None)
Upon user deletion, mark associated forms as deleted and prep cases
    for a rebuild.
    - 2 saves/sec for cloudant slowness (rate_limit)
Upon user deletion, mark associated forms as deleted and prep cases
    for a rebuild.
    - 2 saves/sec for cloudant slowness (rate_limit)
Upon user deletion mark associated forms as deleted and prep cases for a rebuild . - 2 saves / sec for cloudant slowness ( rate_limit )
def tag_forms_as_deleted_rebuild_associated_cases(user_id, domain, form_id_list, deletion_id,
                                                  deletion_date, deleted_cases=None):
    """
    Upon user deletion, mark associated forms as deleted and prep cases
    for a rebuild.
    - 2 saves/sec for cloudant slowness (rate_limit)
    """
    deleted_cases = deleted_cases or set()
    cases_to_rebuild = set()

    for form in FormAccessors(domain).iter_forms(form_id_list):
        if form.domain != domain or not form.is_normal:
            continue

        # rebuild all cases anyways since we don't know if this has run or not if the task was killed
        cases_to_rebuild.update(get_case_ids_from_form(form))

    # do this after getting case_id's since iter_forms won't return deleted forms
    FormAccessors(domain).soft_delete_forms(list(form_id_list), deletion_date, deletion_id)

    detail = UserArchivedRebuild(user_id=user_id)
    for case_id in cases_to_rebuild - deleted_cases:
        _rebuild_case_with_retries.delay(domain, case_id, detail)
def tag_forms_as_deleted_rebuild_associated_cases ( user_id , domain , form_id_list , deletion_id , deletion_date , deleted_cases = None ) : deleted_cases = deleted_cases or set ( ) cases_to_rebuild = set ( ) for form in FormAccessors ( domain ) . iter_forms ( form_id_list ) : if form . domain != domain or not form . is_normal : continue # rebuild all cases anyways since we don't know if this has run or not if the task was killed cases_to_rebuild . update ( get_case_ids_from_form ( form ) ) # do this after getting case_id's since iter_forms won't return deleted forms FormAccessors ( domain ) . soft_delete_forms ( list ( form_id_list ) , deletion_date , deletion_id ) detail = UserArchivedRebuild ( user_id = user_id ) for case_id in cases_to_rebuild - deleted_cases : _rebuild_case_with_retries . delay ( domain , case_id , detail )