Created
June 5, 2012 18:11
-
-
Save kmiyashiro/2876644 to your computer and use it in GitHub Desktop.
dbready
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Calls done when db is finished connecting | |
exports.dbReady = function(done) { | |
var db = require('../../models/db'); | |
switch (db.state) { | |
case 'connected': | |
done(); | |
break; | |
case 'connecting': | |
db.once('open', done); | |
break; | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment