How to prevent failover due to max_connections reached

First of all, I am aware failover due to “pq: remaining connection slots are reserved for non
-replication superuser connections” (as well as any other fatal error) is intended behavior.

I supposed primary cause was too low default value of superuser_reserved_connections. However, with superuser_reserved_connections=20 I met same error and failover. My settings was:

superuser_reserved_connections: “20”
max_connections: “1600”

At time of failover there was 1579 active sessions. I double check - stolon user have SUPERUSER permission. Stolon runs 2 keepers, 2 sentinels and 2 proxies. Other source of superuser connections in postgres-exporter. That’s all, 20 reserved connections is more than enough.

Please advice how to set up postgres and keeper to withstand maxed out user connections.