Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Databse connection timeout #112

Closed
willrnch opened this issue Apr 10, 2013 · 3 comments
Closed

Databse connection timeout #112

willrnch opened this issue Apr 10, 2013 · 3 comments

Comments

@willrnch
Copy link

Keeping connection open cause problems with services (like cleardb) that kill the connection after a few times.

@dresende
Copy link
Owner

You mean auto-reconnect right?

@dresende
Copy link
Owner

I'm working on something but for now it's just for mysql, I still have to see how the other drivers can handle it.

dresende added a commit that referenced this issue Apr 10, 2013
@dresende
Copy link
Owner

Usage:

orm.settings.set("connection.reconnect", true);
orm.connect("...", function (err, db) {
    // ...
});

This option automatically reconnects (only mysql for now) when connection drops. I'm not sure this is what you're looking for. Perhaps you're better with the pool option, which only connects (if needed) when a query is required:

orm.connect("mysql://..../database?pool=true", function (err, db) {
    // ...
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants