Fix a litle bug around psycopg 3.0 (#2123)

Cursor.execute now returns cursor itself, while in psycopg2 it was returning None
This commit is contained in:
Alexander Kukushkin
2021-11-19 16:29:39 +01:00
committed by GitHub
parent 17e523b175
commit 256a359a1e
2 changed files with 3 additions and 2 deletions
+1 -1
View File
@@ -598,7 +598,7 @@ class Postgresql(object):
cur.execute('SELECT pg_catalog.pg_is_in_recovery()')
if cur.fetchone()[0]:
return 'is_in_recovery=true'
return cur.execute('CHECKPOINT')
cur.execute('CHECKPOINT')
except psycopg.Error:
logger.exception('Exception during CHECKPOINT')
return 'not accessible or not healty'
+2 -1
View File
@@ -230,8 +230,9 @@ class Rewind(object):
with self._checkpoint_task_lock:
if self._checkpoint_task:
with self._checkpoint_task:
if self._checkpoint_task.result:
if self._checkpoint_task.result is not None:
self._state = REWIND_STATUS.CHECKPOINT
self._checkpoint_task = None
elif self._postgresql.get_master_timeline() == self._postgresql.pg_control_timeline():
self._state = REWIND_STATUS.CHECKPOINT
else: