changeset 808:4411b124f647 pytest2

moin index --action build --procs 1 --> use simple writer, not MultiSegmentWriter
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Wed, 31 Aug 2011 00:38:43 +0200
parents 0ffa96e9e7f2
children b38ec86abed0
files MoinMoin/script/maint/index.py
diffstat 1 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/script/maint/index.py	Tue Aug 30 23:21:00 2011 +0200
+++ b/MoinMoin/script/maint/index.py	Wed Aug 31 00:38:43 2011 +0200
@@ -60,8 +60,16 @@
             Building in app.cfg.index_dir_tmp
             """
             indexnames = [indexname for indexname, schema in indexnames_schemas]
-            with MultiSegmentWriter(all_rev_index, procs, limitmb) as all_rev_writer:
-                with MultiSegmentWriter(latest_rev_index, procs, limitmb) as latest_rev_writer:
+            if procs == 1:
+                # MultiSegmentWriter sometimes has issues and is pointless for procs == 1,
+                # so use the simple writer when --procs 1 is given:
+                _all_rev_writer = all_rev_index.writer()
+                _latest_rev_writer = latest_rev_index.writer()
+            else:
+                _all_rev_writer = MultiSegmentWriter(all_rev_index, procs, limitmb)
+                _latest_rev_writer = MultiSegmentWriter(latest_rev_index, procs, limitmb)
+            with _all_rev_writer as all_rev_writer:
+                with _latest_rev_writer as latest_rev_writer:
                     for item in backend.iter_items_noindex():
                         try:
                             rev_no = None