Comments (2)
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.
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)
- Look into the changes of poolboy 1.5.X HOT 3
- last_insert_id ? HOT 2
- Bump deps MySQL/OTP 1.1.1 HOT 1
- Not prepared error HOT 1
- Restarting the mysql server is not detected by the driver. HOT 24
- Closed connection is not detected HOT 1
- rebar.config and Makefile mysql-otp mismatch HOT 2
- Function name "checkout_connection" is too long HOT 1
- could you update rebar.config to point to the latest mysql-otp ? HOT 6
- Add this to Hex? HOT 1
- I get the tcp_closed every day HOT 6
- with/2 for checkout-Fun()-checkin without SQL transaction HOT 1
- Use lazy connect and let server disconnect on inactivity HOT 4
- execute/3,4 for prepared statements HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mysql-otp-poolboy.