Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.7.8 #65

Merged
merged 3 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Loading