Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Fix bulk queue to lock before saving to ES #1358

Merged
merged 2 commits into from Jul 9, 2019
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions mozdef_util/HISTORY.rst
Expand Up @@ -86,3 +86,9 @@ Add is_ip utility function

* Updated to work with python3
* Removed support for python2


3.0.1 (2019-07-08)
------------------

* Updated bulk queue to acquire lock before saving events
2 changes: 1 addition & 1 deletion mozdef_util/mozdef_util/bulk_queue.py
Expand Up @@ -52,9 +52,9 @@ def size(self):

def flush(self):
""" Write all stored events to ES """
self.es_client.save_documents(self.list)
self.lock.acquire()
try:
self.es_client.save_documents(self.list)
self.list = list()
finally:
self.lock.release()
2 changes: 1 addition & 1 deletion mozdef_util/setup.py
Expand Up @@ -59,6 +59,6 @@
test_suite='tests',
tests_require=[],
url='https://github.com/mozilla/MozDef/tree/master/lib',
version='3.0.0',
version='3.0.1',
zip_safe=False,
)
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -30,7 +30,7 @@ jmespath==0.9.3
kombu==4.1.0
meld3==1.0.2
mozdef-client==1.0.11
mozdef-util==3.0.0
mozdef-util==3.0.1
netaddr==0.7.19
nose==1.3.7
oauth2client==1.4.12
Expand Down