Merge pull request #7128 from wwitzel3/issue-4040

Set capacity to zero before shutting down older instances
This commit is contained in:
Wayne Witzel III
2017-07-18 13:40:52 -04:00
committed by GitHub

View File

@@ -195,7 +195,14 @@ def cluster_node_heartbeat(self):
other_inst.version,
inst.hostname,
inst.version))
# Set the capacity to zero to ensure no Jobs get added to this instance.
# The heartbeat task will reset the capacity to the system capacity after upgrade.
inst.capacity = 0
inst.save()
stop_local_services(['uwsgi', 'celery', 'beat', 'callback', 'fact'])
# We wait for the Popen call inside stop_local_services above
# so the line below will rarely if ever be executed.
raise RuntimeError("Shutting down.")
@task(bind=True)