Patroni: PostgreSQL parameter changes not taken into account (when restart is required)

pglift version

2.6.1

Summary

If I create an instance with Patroni.

pglift instance create pg1 --patroni-cluster=pgdemo --patroni-node=pg1

And change the port afterwards with the alter command:

pglift -LDEBUG instance alter pg1 --port=5433

I get errors if the answer to the restart confirmation is given quickly. Everything works fine if I patiently wait for 6 to 10 seconds before answering.

Errors

I had 3 possible errors:

1. Several "no responses" answers for the pg_isready command (with port possibly changing among the different calls)
DEBUG    checking if PostgreSQL instance 18/pg1 is ready                                                                                                      
DEBUG    /usr/lib/postgresql/18/bin/pg_isready -d 'user=postgres port=5433 host=/run/user/1000/pglift/postgresql passfile=/home/pierre/.pgpass dbname=postgres'                                                                                                                                     
DEBUG    /usr/lib/postgresql/18/bin/pg_isready: /run/user/1000/pglift/postgresql:5433 - no response 
2. An uncaught HTTPStatusError (unexpected error occured)
  File "/home/pierre/work/pglift/.venv/lib/python3.13/site-packages/httpx/_models.py", line 829, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Server error '503 Service Unavailable' for url 'http://192.168.0.36:8008/restart'
3. Failing connection to instance with new port
DEBUG    checking if PostgreSQL instance 18/pg1 is ready                                                                                                      
DEBUG    /usr/lib/postgresql/18/bin/pg_isready -d 'user=postgres port=5432 host=/run/user/1000/pglift/postgresql passfile=/home/pierre/.pgpass                
         dbname=postgres'                                                                                                                                     
DEBUG    /usr/lib/postgresql/18/bin/pg_isready: /run/user/1000/pglift/postgresql:5432 - accepting connections                                                 
DEBUG    connecting to PostgreSQL instance with: user=postgres passfile=/home/pierre/.pgpass dbname=postgres host=/run/user/1000/pglift/postgresql port=5433  
DEBUG    a database error occurred: connection is bad: connection to server on socket "/run/user/1000/pglift/postgresql/.s.PGSQL.5433" failed: No such file or
         directory                                                                                                                                            
                 Is the server running locally and accepting connections on that socket? (SQLSTATE=None)                                                      
Error: connection is bad: connection to server on socket "/run/user/1000/pglift/postgresql/.s.PGSQL.5433" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?

Notice the 5432 port when calling the pg_isready.

After any of those errors, a pglift instance restart is required.