PostgREST / postgrest

REST API for any Postgres database
https://postgrest.org
MIT License
23.27k stars 1.02k forks source link

Fix error logs when the listener connects to a read replica #3588

Open laurenceisla opened 3 months ago

laurenceisla commented 3 months ago

In the PostgREST 12.2.0 logs, when connecting to a read replica only, it shows:

12/Jun/2024:15:19:57 -0500: Failed listening for notifications on the "pgrst" channel. Just "connection to server on socket \"/run/user/1000/postgrest/postgrest-with-postgresql-16-Y3M/socket_replica_6039/.s.PGSQL.5432\" failed: session is read-only\n"
12/Jun/2024:15:19:57 -0500: Failed listening for notifications on the "pgrst" channel. ExitFailure 1

_Originally posted by @laurenceisla in https://github.com/PostgREST/postgrest/pull/3582#discussion_r1637039130_

The first log prints ... Just "<error_message>", it should only print ... <error_message>. And the second log seems redundant.