fly_postgres_elixir
fly_postgres_elixir copied to clipboard
Writes fail (RPC timeouts) whenever the DB is not available in the current region
Attempting to use the Fly repo from any region in which a replica is not yet running, seems to work perfectly fine...
... that is, until any mutating calls (insert
, update
etc), or calls like Fly.Postgres.rpc_and_wait
are made. Instead of transparently falling back to directly using the sole available DB connection (and maybe logging a warning?), these RPC calls will always time out.
At first I thought this was just a 'principle of least surprise' kind of issue that users which follow the guide to the letter would not stumble across. But actually the problematic situation can also arise during normal operation: When the read replica in the local region fails, DB traffic from that region is again transparently rerouted to the primary DB and the same situation occurs!