-
-
Save seankelly/5034964 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@defer.inlineCallbacks | |
def _soft_disconnect(self, fast=False): | |
if self.build_wait_timeout < 0: | |
yield AbstractBuildSlave.disconnect(self) | |
return | |
if self.missing_timer: | |
self.missing_timer.cancel() | |
self.missing_timer = None | |
if self.substantiation_deferred is not None: | |
log.msg("Weird: Got request to stop before started. Allowing slave to start cleanly to avoid inconsistent state") | |
yield self.substantiation_deferred | |
self.substantiation_deferred = None | |
self.substantiation_build = None | |
log.msg("Substantiation complete, immediately terminating.") | |
if self.slave is not None: | |
# this could be called when the slave needs to shut down, such as | |
# in BotMaster.removeSlave, *or* when a new slave requests a | |
# connection when we already have a slave. It's not clear what to | |
# do in the second case: this shouldn't happen, and if it | |
# does...if it's a latent slave, shutting down will probably kill | |
# something we want...but we can't know what the status is. So, | |
# here, we just do what should be appropriate for the first case, | |
# and put our heads in the sand for the second, at least for now. | |
# The best solution to the odd situation is removing it as a | |
# possibilty: make the master in charge of connecting to the | |
# slave, rather than vice versa. TODO. | |
yield defer.DeferredList([ | |
AbstractBuildSlave.disconnect(self), | |
self.insubstantiate(fast) | |
]) | |
else: | |
yield AbstractBuildSlave.disconnect(self) | |
yield self.stop_instance(fast) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment