Multi-PostgreSQL based on http header value - Ruby on Rails

Joined
Jun 15, 2015
Messages
1
Reaction score
0
Hi everybody !

We are currenlty working on a project with multiple openstreetmap postgresql databases installed and one api instance, i added a X-Venue header for requests to route to a specified correctly installed database.

I've updated ApplicationController to connect to the specified database, it works but when i connect to a non existing database, it returns database not found even if the database is correct on future calls

Here is the code : https://gist.github.com/franckt/7c6a8cf5f0d7deffb9be

I'm not sure how rails works with pgsql, when the first connection occurs, and if establish_connection() is the good way, it seems that some connection polling somewhere keeps latest bad connection.

If i restart the server (bundle exec rails server) it works again
Is it because Rails doesn't close connections by default ?

Any help on that ?

(original issue was posted on openstreetmap/openstreetmap-website#980 but it's a rails issue in fact)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top