Giter Club home page Giter Club logo

Comments (7)

mnelson avatar mnelson commented on August 20, 2024

This is probably surprising behavior but intentional, at least in PG. The issue is the PG adapter calls connect upon instantiation. Since the instantiation of this connection takes place when the adapter is filling the master / slave pools the error is raised early. When the error is raised I do not put the connection in the pool. This means in this scenario you're dealing with 1 master and 0 slaves. So all connections are blacklisted anytime you try to do anything.

I'm thinking the right thing to do is go ahead and place the connection in the pool, but then immediately blacklist it. Thoughts?

from makara.

jdowning avatar jdowning commented on August 20, 2024

Yes, that is the desired behavior. Put all database.yml connections in the pool and let makara manage them based on availability.

from makara.

mnelson avatar mnelson commented on August 20, 2024

Ah, now I remember going down this road. So the issue is connect() is called from within initialize(). So the object is never returned. You can do Class.allocate but that means the pg makara adapter would have to deal with different configurations and different constructors from different ActiveRecord versions since it would essentially redefine ::ActiveRecord::Base.postgresql_connection().

from makara.

mnelson avatar mnelson commented on August 20, 2024

Another possible option is to delay the instantiation by creating an empty wrapper. Then the connection would be instantiated on demand. I'll investigate that as a solution.

from makara.

mnelson avatar mnelson commented on August 20, 2024

Ok, here's my first attempt. #35

from makara.

jdowning avatar jdowning commented on August 20, 2024

Is there any way to log/see makara activity? eg: add, blacklist, errors

from makara.

mnelson avatar mnelson commented on August 20, 2024

Not currently, I'm a bit busy today but will try to add logging tonight.

from makara.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.