Quantcast
Channel: Active questions tagged ruby - Stack Overflow
Viewing all articles
Browse latest Browse all 4622

How to auto reconnect Rails 6 PostgreSQL connection?

$
0
0

I have a rails 6 application with some worker processes. The app uses PostgreSQL as a DB. Sometimes the DB reboots (e.g. minor version upgrade) and workers lose their connection. I'd expect them to auto-reconnect but it doesn't happen.

I tried to use reconnect: true flag in database.yml. The same story. I still receive PG::UnableToSend: no connection to the server. The option is not even available in PostgresqlAdapter. I guess it's only the MySQL adapter option.

The workers are simple service classes I run with rails runner

What could be done? I believe the answer must be simple.


Viewing all articles
Browse latest Browse all 4622

Trending Articles