Clients will still be connected to a Patroni host as a master after a failover

Consider this scenario:

  • Clients have established connections to patroni-01 (the current master)
  • We do a failover to patroni-02, making patroni-01 a read-only replica
  • The clients will still be issuing read-write queries to patroni-01, which will fail

We need a mechanism to (gracefully) terminate established connections to a former master after a failover. Probably we will use the callback feature provided by Patroni.

cc/ @Finotto