[Amnet] Allow DB to be idled
Amnet would like to allow their DB server to go idle after a certain timeout, to reduce hosting costs. Two things need to be resolved:
- We need to make sure that reconnecting works correctly. In the past we've seen this:
[dbConnection=4131091485] The database connection closed. Reason: The pool reached the maximum connection setting, and a connection with different properties was required.
... which indicates that new connections need to be created. I'm not yet sure whether this will work automatically. - We need to avoid the DB queries we currently make every minute to check if any notifications need to be sent: these will prevent the DB ever going idle. The application could be made more clever about remembering when the next notification will need to be sent, rather than rechecking the DB every minute.