Skip to content

Commit

Permalink
Merge pull request #65 from certego/develop
Browse files Browse the repository at this point in the history
0.7.8
  • Loading branch information
mlodic authored Nov 30, 2023
2 parents 6c26138 + fb99814 commit 0aa0bf4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
1 change: 1 addition & 0 deletions certego_saas/ext/upload/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# flake8: noqa
from .elastic import BIDocument, __BIDocumentInterface
from .slack import Slack
from .twitter import Twitter
14 changes: 8 additions & 6 deletions certego_saas/ext/upload/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,17 @@ def upload(
qs.filter(index=index)
docs = qs.order_by("+creation_date")
if max_number:
if max_number > 10000:
return False, [
"max_number can't be higher than 10000 for performance reasons."
]
docs = docs[:max_number]
num_docs = docs.count()
logger.info(f"Uploading {num_docs} documents")
logger.info(f"Uploading {docs.count()} documents")
jsons = map(lambda x: x.to_bulk(), docs)
success, errors = bulk(client, jsons, request_timeout=timeout)
logger.info(f"Finished Upload. Deleting {num_docs} documents")
for doc in docs.iterator():
doc.delete()
logger.info(f"Finished deleting {num_docs} documents")
logger.info("Finished Upload. Starting deletion documents")
docs.delete()
logger.info("Finished deleting documents")
return success, errors

def clean(self):
Expand Down
2 changes: 1 addition & 1 deletion certego_saas/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "0.7.7"
VERSION = "0.7.8"

0 comments on commit 0aa0bf4

Please sign in to comment.