Giter Site home page Giter Site logo

Comments (2)

zuiderkwast avatar zuiderkwast commented on July 19, 2024

Idea!

One problem with starting pools from config files is that if multiple config files are used to define pools, they would all want to set {mysql_poolboy, {pools, Pools}}. Then if two config files are used, the second config file would override the pools defined by the first config file.

But what we can do is (and this is the idea) to use the env keys as pool names. Then different config files can define different pools without overwriting eachother's pool specs. We don't need any other env keys than pools anyway for mysql_poolboy.

Example:

$ erl -config log_db.config -config master_db.config -pa ebin ...
%% log_db.config
{mysql_poolboy, [
    {log, {[{size, 2}],
           [{host, "192.168.0.7"}, {user, "log"}, {password, "xyz123456"}]}}
]}.
%% master_db.config
{mysql_poolboy, [
    {master_db, {[{size, 50}],
                 [{host, "192.168.0.2"}, {user, "foo"}, {password, "d8s9s8uw98c"}]}}
]}.

from mysql-otp-poolboy.

RaoH avatar RaoH commented on July 19, 2024

Sorry about the late answer, christmas time lead to not being at the computer at all almost.
Hmm, when I just quickly structured the example app, I didn't consider the clumsiness having the settings in the app conf file. Now thinking off it, it shouldn't at all be there at all. It's up to the application using this library to have the configuration one way or the other.

But yes add_pool is a bad name considering what it does and since we are not supervising the pool in this app, then it's kinda bad design. So I agree on just wrapping it with mysql_poolboy:child_spec/3.

But if we should keep it and supervise pools, then perhaps another module for it? Seperating concern and functions?

I do like the idea with multiple config files as you suggest. It's very sleek and would mean that adding more db pools is easy and quick, just a simple restart of the application and it's done.

from mysql-otp-poolboy.

Related Issues (15)

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.