Ha loop was writing into scheduled_at during "manual_failover"

This commit is contained in:
Alexander Kukushkin
2016-03-18 13:24:30 +01:00
parent 92394598c7
commit ca3414bda0
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -197,7 +197,7 @@ class RestApiHandler(BaseHTTPRequestHandler):
elif scheduled_at < datetime.datetime.now(pytz.utc):
data = b'Cannot schedule failover in the past'
status_code = 422
elif self.server.patroni.dcs.manual_failover(leader, member, scheduled_at):
elif self.server.patroni.dcs.manual_failover(leader, member, scheduled_at=scheduled_at):
data = b'Failover scheduled'
status_code = 200
except (ValueError, TypeError):
+2 -2
View File
@@ -298,7 +298,7 @@ class Ha(object):
return
elif delta < - int(self.patroni.nap_time * 1.5):
logger.warning('Found a stale failover value, cleaning up: %s', failover.scheduled_at)
self.dcs.manual_failover('', '', self.cluster.failover.index)
self.dcs.manual_failover('', '', index=self.cluster.failover.index)
return
# The value is very close to now
@@ -323,7 +323,7 @@ class Ha(object):
self.cluster.failover.leader, self.state_handler.name)
logger.info('Trying to clean up failover key')
self.dcs.manual_failover('', '', self.cluster.failover.index)
self.dcs.manual_failover('', '', index=self.cluster.failover.index)
def process_unhealthy_cluster(self):
if self.is_healthiest_node():