def bulk_delete(db, docs): if not docs: return logger.info("Deleting {} doc revisions".format(len(docs))) try: db.bulk_delete(docs) except BulkSaveError as e: errors = categorize_bulk_save_errors(e) successes = errors.pop(None, []) conflicts = errors.pop('conflict', []) logger.error("BulkSaveError: {} successful, {} conflicts".format(len(successes), len(conflicts))) for error, results in errors.items(): logger.error(results) else: logger.info('{} doc revisions deleted'.format(len(docs)))
def bulk_delete(db, docs): if not docs: return logger.info("Deleting {} doc revisions".format(len(docs))) try: db.bulk_delete(docs) except BulkSaveError as e: errors = categorize_bulk_save_errors(e) successes = errors.pop(None, []) conflicts = errors.pop('conflict', []) logger.error("BulkSaveError: {} successful, {} conflicts".format(len(successes), len(conflicts))) for error, results in errors.items(): logger.error(results) else: logger.info('{} doc revisions deleted'.format(len(docs)))