def get_local_connection_cursor(self, **kwargs: Any) -> Iterator[Union['cursor', 'Cursor[Any]']]:
        """Create a new database connection to local server.

        Create a non-blocking connection cursor to avoid the situation where an execution of the query of
        ``pg_replication_slot_advance`` takes longer than the timeout on a HA loop, which could cause a false
        failure state.

        :param kwargs: Any keyword arguments to pass to :func:`psycopg.connect`.

        :yields: connection cursor object, note implementation varies depending on version of :mod:`psycopg`.
        """
        conn_kwargs = {**self._postgresql.connection_pool.conn_kwargs, **kwargs}
        with get_connection_cursor(**conn_kwargs) as cur:
            yield cur
Create a new database connection to local server.

        Create a non-blocking connection cursor to avoid the situation where an execution of the query of
        ``pg_replication_slot_advance`` takes longer than the timeout on a HA loop, which could cause a false
        failure state.

        :param kwargs: Any keyword arguments to pass to :func:`psycopg.connect`.

        :yields: connection cursor object, note implementation varies depending on version of :mod:`psycopg`.
        
patroni/postgresql/slots.py