simplify when_connected_enough()

This seems happier as a method on StorageBroker, rather than a
completely separate helper class.
This commit is contained in:
Brian Warner
2016-07-21 17:23:22 -07:00
parent c15d706faf
commit 1b64ab5e85
3 changed files with 35 additions and 50 deletions

View File

@ -491,14 +491,12 @@ class Client(node.Node, pollmixin.PollMixin):
s.setServiceParent(self)
s.startService()
# start processing the upload queue when we've connected to enough servers
connection_threshold = min(self.encoding_params["k"],
self.encoding_params["happy"] + 1)
connected = storage_client.ConnectedEnough(
self.storage_broker,
connection_threshold,
)
connected.when_connected_enough().addCallback(lambda ign: s.ready())
# start processing the upload queue when we've connected to
# enough servers
threshold = min(self.encoding_params["k"],
self.encoding_params["happy"] + 1)
d = self.storage_broker.when_connected_enough(threshold)
d.addCallback(lambda ign: s.ready())
def _check_exit_trigger(self, exit_trigger_file):
if os.path.exists(exit_trigger_file):