From: Kevan Carstensen <kevan@isnotajoke.com>
Date: Wed, 28 Dec 2011 05:50:18 +0000 (-0800)
Subject: mutable publish: fix not-enough-shares detection. Refs #1628.
X-Git-Url: https://git.rkrishnan.org/components/com_hotproperty/simplejson/cyclelanguage?a=commitdiff_plain;h=147670fd89a04bad564faa0d1cdbf2803ea90b93;p=tahoe-lafs%2Ftahoe-lafs.git

mutable publish: fix not-enough-shares detection. Refs #1628.

This should match the "fix-1628.darcs.2.patch" attachment on that ticket.
---

diff --git a/src/allmydata/mutable/publish.py b/src/allmydata/mutable/publish.py
index 1e2de76d..e8f2ebb4 100644
--- a/src/allmydata/mutable/publish.py
+++ b/src/allmydata/mutable/publish.py
@@ -623,10 +623,9 @@ class Publish:
         # Can we still successfully publish this file?
         # TODO: Keep track of outstanding queries before aborting the
         #       process.
-        all_writers = []
-        for shnum, writers in self.writers.iteritems():
-            all_writers.extend(writers)
-        if len(all_writers) < self.required_shares or self.surprised:
+        all_shnums = filter(lambda sh: len(self.writers[sh]) > 0,
+                            self.writers.iterkeys())
+        if len(all_shnums) < self.required_shares or self.surprised:
             return self._failure()
 
         # Figure out what we need to do next. Each of these needs to