patroni.git / summary / log / commit / refs
commit 05bcbe90eb5feab2e01c2a00a33abdeeb6884b4f
Author: Alexander Kukushkin <cyberdemn@gmail.com>
Commit: GitHub <noreply@github.com>
Date: Thu Aug 25 08:43:50 2016 +0000
close connection on start instead of stop (#272)
patroni/postgresql.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/patroni/postgresql.py b/patroni/postgresql.py
index 31f45148..da4b932a 100644
--- a/patroni/postgresql.py
+++ b/patroni/postgresql.py
@@ -503,6 +503,12 @@ class Postgresql(object):
self._state = value
def start(self, block_callbacks=False):
+ # make sure we close all connections established against
+ # the former node, otherwise, we might get a stalled one
+ # after kill -9, which would report incorrect data to
+ # patroni.
+ self.close_connection()
+
if self.is_running():
logger.error('Cannot start PostgreSQL because one is already running.')
return True
@@ -559,12 +565,6 @@ class Postgresql(object):
return 'not accessible or not healty'
def stop(self, mode='fast', block_callbacks=False, checkpoint=True):
- # make sure we close all connections established against
- # the former node, otherwise, we might get a stalled one
- # after kill -9, which would report incorrect data to
- # patroni.
-
- self.close_connection()
if not self.is_running():
if not block_callbacks:
self.set_state('stopped')
[parent: b472a3258952]