mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2024-12-20 05:28:04 +00:00
immutable/encode.py: tolerate immediate _remove_shareholder by copying the
landlord list before iterating over it. This can probably only happen in unit tests, but cleaning it up makes certain test failures easier to analyze.
This commit is contained in:
parent
1863aee0aa
commit
de83526acd
@ -285,7 +285,7 @@ class Encoder(object):
|
|||||||
self.log("starting shareholders", level=log.NOISY)
|
self.log("starting shareholders", level=log.NOISY)
|
||||||
self.set_status("Starting shareholders")
|
self.set_status("Starting shareholders")
|
||||||
dl = []
|
dl = []
|
||||||
for shareid in self.landlords:
|
for shareid in list(self.landlords):
|
||||||
d = self.landlords[shareid].put_header()
|
d = self.landlords[shareid].put_header()
|
||||||
d.addErrback(self._remove_shareholder, shareid, "start")
|
d.addErrback(self._remove_shareholder, shareid, "start")
|
||||||
dl.append(d)
|
dl.append(d)
|
||||||
@ -526,7 +526,7 @@ class Encoder(object):
|
|||||||
all_hashes = list(t)
|
all_hashes = list(t)
|
||||||
self.uri_extension_data["crypttext_root_hash"] = t[0]
|
self.uri_extension_data["crypttext_root_hash"] = t[0]
|
||||||
dl = []
|
dl = []
|
||||||
for shareid in self.landlords.keys():
|
for shareid in list(self.landlords):
|
||||||
dl.append(self.send_crypttext_hash_tree(shareid, all_hashes))
|
dl.append(self.send_crypttext_hash_tree(shareid, all_hashes))
|
||||||
return self._gather_responses(dl)
|
return self._gather_responses(dl)
|
||||||
|
|
||||||
@ -611,7 +611,7 @@ class Encoder(object):
|
|||||||
self.log("uri_extension_data is %s" % (ed,), level=log.NOISY, parent=lp)
|
self.log("uri_extension_data is %s" % (ed,), level=log.NOISY, parent=lp)
|
||||||
self.uri_extension_hash = hashutil.uri_extension_hash(uri_extension)
|
self.uri_extension_hash = hashutil.uri_extension_hash(uri_extension)
|
||||||
dl = []
|
dl = []
|
||||||
for shareid in self.landlords.keys():
|
for shareid in list(self.landlords):
|
||||||
dl.append(self.send_uri_extension(shareid, uri_extension))
|
dl.append(self.send_uri_extension(shareid, uri_extension))
|
||||||
return self._gather_responses(dl)
|
return self._gather_responses(dl)
|
||||||
|
|
||||||
@ -626,7 +626,7 @@ class Encoder(object):
|
|||||||
self.set_status("Closing Shareholders")
|
self.set_status("Closing Shareholders")
|
||||||
self.set_encode_and_push_progress(extra=0.9)
|
self.set_encode_and_push_progress(extra=0.9)
|
||||||
dl = []
|
dl = []
|
||||||
for shareid in self.landlords:
|
for shareid in list(self.landlords):
|
||||||
d = self.landlords[shareid].close()
|
d = self.landlords[shareid].close()
|
||||||
d.addErrback(self._remove_shareholder, shareid, "close")
|
d.addErrback(self._remove_shareholder, shareid, "close")
|
||||||
dl.append(d)
|
dl.append(d)
|
||||||
@ -653,7 +653,7 @@ class Encoder(object):
|
|||||||
# we need to abort any remaining shareholders, so they'll delete the
|
# we need to abort any remaining shareholders, so they'll delete the
|
||||||
# partial share, allowing someone else to upload it again.
|
# partial share, allowing someone else to upload it again.
|
||||||
self.log("aborting shareholders", level=log.UNUSUAL)
|
self.log("aborting shareholders", level=log.UNUSUAL)
|
||||||
for shareid in list(self.landlords.keys()):
|
for shareid in list(self.landlords):
|
||||||
self.landlords[shareid].abort()
|
self.landlords[shareid].abort()
|
||||||
if f.check(defer.FirstError):
|
if f.check(defer.FirstError):
|
||||||
return f.value.subFailure
|
return f.value.subFailure
|
||||||
|
Loading…
Reference in New Issue
Block a user