summaryrefslogtreecommitdiff
path: root/service/pixelated/adapter/search
diff options
context:
space:
mode:
authorFolker Bernitt <fbernitt@thoughtworks.com>2015-03-17 11:03:06 +0100
committerFolker Bernitt <fbernitt@thoughtworks.com>2015-03-17 11:03:06 +0100
commite9a675d925778ef3ec6c38e235a71b25c1e3b344 (patch)
tree4cfa160cd91cde6191a248425d0a7621e088d8b9 /service/pixelated/adapter/search
parent47d99ab297844fd54b66cef45c7786ebf0e5ca41 (diff)
Lock index on index_mail.
- Issue #330
Diffstat (limited to 'service/pixelated/adapter/search')
-rw-r--r--service/pixelated/adapter/search/__init__.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/service/pixelated/adapter/search/__init__.py b/service/pixelated/adapter/search/__init__.py
index 0b1a1034..f1828780 100644
--- a/service/pixelated/adapter/search/__init__.py
+++ b/service/pixelated/adapter/search/__init__.py
@@ -116,8 +116,9 @@ class SearchEngine(object):
return FileIndex.create(storage, self._mail_schema(), indexname='mails')
def index_mail(self, mail):
- with self._index.writer() as writer:
- self._index_mail(writer, mail)
+ with self._write_lock:
+ with self._index.writer() as writer:
+ self._index_mail(writer, mail)
def _index_mail(self, writer, mail):
mdict = mail.as_dict()