def ensure_checkpoint_after_promote(self, wakeup: Callable[..., Any]) -> None:
        """After promote issue a CHECKPOINT from a new thread and asynchronously check the result.
        In case if CHECKPOINT failed, just check that timeline in pg_control was updated."""

        if self._state != REWIND_STATUS.CHECKPOINT and self._postgresql.is_primary():
            with self._checkpoint_task_lock:
                if self._checkpoint_task:
                    result = None

                    with self._checkpoint_task:
                        result = self._checkpoint_task.result

                    if result is True:
                        self._state = REWIND_STATUS.CHECKPOINT

                    if result is not None:
                        self._checkpoint_task = None
                elif self._postgresql.get_primary_timeline() == self._postgresql.pg_control_timeline():
                    self._state = REWIND_STATUS.CHECKPOINT
                else:
                    self._checkpoint_task = CriticalTask()
                    Thread(target=self.__checkpoint, args=(self._checkpoint_task, wakeup)).start()
After promote issue a CHECKPOINT from a new thread and asynchronously check the result.
        In case if CHECKPOINT failed, just check that timeline in pg_control was updated.
patroni/postgresql/rewind.py