Skip to content
Browse files

some logic errors and forgot the callback

  • Loading branch information...
1 parent b0b7c10 commit 666f9e07190319c243f87a38007fed60c434e1f6 Peteris Krumins committed with Oct 8, 2010
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/store.js
View
4 lib/store.js
@@ -34,7 +34,6 @@ function Store(opts, cb) {
self.on('ready', function () {
ready = true;
- openDbs[opts.filename] = self;
actionQueue.forEach(function (action) {
self[action.action].apply(action.args);
});
@@ -43,16 +42,19 @@ function Store(opts, cb) {
if (openDbs[opts.filename]) {
var db = openDbs[opts.filename];
+ cb(undefined, self);
}
else {
var db = new SQLite();
db.open(opts.filename, function (error) {
if (error) {
self.emit('error', error);
+ delete openDbs[opts.filename];
cb(error);
}
initStoreTable();
});
+ openDbs[opts.filename] = self;
}
function initStoreTable() {

0 comments on commit 666f9e0

Please sign in to comment.
Something went wrong with that request. Please try again.