Make lazy db property configurable and delete on server close
db property is currently not being garbage collected when the server is closed.
While this would not be an issue during normal usage (i.e., create a single server, exit process on server close), it did raise its head in the tests where we create and destroy different Site.js instances pointing at different directories.
If the global
db property is not properly garbage collected, what happens is that it encloses around the database path of the Site.js instance that it was created on and then, if it is accessed later from a different Site.js instance in the same process, it lazily creates the database at the original (not latest) database path.
Needless to say, this was a hairy one to track down :)
- Make the global
- Delete the global
dbproperty after (async) closing the database on server close.