Commits

Matt Chaput  committed 2275d1c

Don't queue an empty doc buffer in MpWriter. Fixes issue #245.

  • Participants
  • Parent commits 9db6fa3

Comments (0)

Files changed (2)

File src/whoosh/filedb/multiproc.py

     def _commit(self, mergetype, optimize, merge):
         try:
             # Index the remaining documents in the doc buffer
-            self._enqueue()
+            if self.docbuffer:
+                self._enqueue()
             # Tell the tasks to finish
             for task in self.tasks:
                 self.jobqueue.put(None)

File tests/test_mpwriter.py

                     assert word in hit["a"].split()
 
 
+@skip_if(no_multi)
+def test_batchsize_eq_doccount():
+    from whoosh.filedb.multiproc import MpWriter
 
+    schema = fields.Schema(a=fields.KEYWORD(stored=True))
+    with TempIndex(schema) as ix:
+        with ix.writer(procs=4, batchsize=10) as w:
+            for i in xrange(10):
+                w.add_document(a=u(str(i)))
 
 
 
 
 
+
+