Code refactoring, per code review by Alex.

This commit is contained in:
Oleksii Kliukin
2015-11-24 16:37:40 +01:00
parent 6d296b1b34
commit 4b1ff5a4bb
+3 -4
View File
@@ -714,7 +714,7 @@ $$""".format(name, options), name, password, password)
bbfailures = 0
maxfailures = 2
ret = 1
while bbfailures < maxfailures:
for bbfailures in range(0, maxfailures):
try:
ret = subprocess.call(['pg_basebackup', '--pgdata=' + self.data_dir,
'--xlog-method=stream', "--dbname=" + master_connection], env=env)
@@ -724,9 +724,8 @@ $$""".format(name, options), name, password, password)
except Exception as e:
logger.error('Error when fetching backup with pg_basebackup: {0}'.format(e))
bbfailures += 1
if bbfailures < maxfailures:
if bbfailures < maxfailures - 1:
logger.error('Trying again in 5 seconds')
time.sleep(5)
time.sleep(5)
return ret