dresende / node-orm2

Object Relational Mapping
http://github.com/dresende/node-orm2
MIT License
3.07k stars 379 forks source link

on error #669

Open oriweingart opened 8 years ago

oriweingart commented 8 years ago

Hi,

Is there any option to register to connection timeout error event? I would like to catch this error an handle it in one place instead of do it in every execution.

Thanks

olee commented 8 years ago

Hi, I have the same problem that my connection to the database drops sometimes and I'm getting ECONNRESET then. Is there a way around this?

dxg commented 8 years ago

Reconnection support would need to be added at the driver level: https://github.com/dresende/node-orm2/tree/master/lib/Drivers/DML

olee commented 8 years ago

I added ?pool=true (mysql driver) to the connection string which is supposed to work. Also I found that setting orm.settings.set('connection.reconnect', true); should work sometimes. I will see if that works and if it does, report here again (if I don't forget it :sweat_smile: ).