Skip to content

Instantly share code, notes, and snippets.

@tucotuco
Last active August 29, 2015 13:57
Show Gist options
  • Save tucotuco/9517787 to your computer and use it in GitHub Desktop.
Save tucotuco/9517787 to your computer and use it in GitHub Desktop.
if len(ids) < 1: # Didn't find any matches in this batch.
if len(docs) == 100:
next_id = docs[-1].doc_id
else:
index.delete(id)
return
else: # Matches found, delete them.
blast, next_id = ids[:-1], ids[-1]
index.delete(blast)
params = dict(index_name=index_name, namespace=namespace, id=next_id,
resource=resource)
if len(docs) >= 100:
logging.info(params)
logging.info('DOCS %s' % len(docs))
logging.info('IDS %s' % len(ids))
if len(blast) == 1 and next_id == blast[0]:
index.delete(next_id)
return
taskqueue.add(url='/index-delete-resource', params=params,
queue_name="index-delete-resource")
@eightysteele
Copy link

if blast and len(blast) == 1 and next_id == blast[0]:

@eightysteele
Copy link

if len(ids) < 1:  # Didn't find any matches in this batch.
    if len(docs) == 100:
        next_id = docs[-1].doc_id
    else:
        index.delete(id)
        return
else:  # Matches found, delete them.
    blast, next_id = ids[:-1], ids[-1]
    index.delete(blast)
params = dict(index_name=index_name, namespace=namespace, id=next_id,
          resource=resource)
if len(docs) >= 100:
    logging.info(params)
    logging.info('DOCS %s' % len(docs))
    logging.info('IDS %s' % len(ids))
    if len(blast) == 1 and next_id == blast[0]:
        index.delete(next_id)
        return
    taskqueue.add(url='/index-delete-resource', params=params,
              queue_name="index-delete-resource")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment