Skip to content

Commit

Permalink
separated setupMappings from ping
Browse files Browse the repository at this point in the history
  • Loading branch information
bharathkontham committed Apr 27, 2019
1 parent 1efbad0 commit 2f34d0e
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions lib/esConnector.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,25 +126,23 @@ ESConnector.prototype.connect = function (callback) {
if (error) {
console.log('ESConnector.prototype.connect', 'ping', 'failed', error);
log('ESConnector.prototype.connect', 'ping', 'failed', error);
callback(null, self.db);
} else {
if (self.settings.mappingProperties) {
self.setupMappings()
.then(function () {
log('ESConnector.prototype.connect', 'setupMappings', 'finished');
callback && callback(null, self.db);
})
.catch(function (err) {
log('ESConnector.prototype.connect', 'setupMappings', 'failed', err);
callback && callback(null, self.db);
});
} else {
process.nextTick(function () {
callback && callback(null, self.db);
});
}
}
});
if (self.settings.mappingProperties) {
self.setupMappings()
.then(function () {
log('ESConnector.prototype.connect', 'setupMappings', 'finished');
callback && callback(null, self.db);
})
.catch(function (err) {
log('ESConnector.prototype.connect', 'setupMappings', 'failed', err);
callback && callback(null, self.db);
});
} else {
process.nextTick(function () {
callback && callback(null, self.db);
});
}
}
};

Expand Down

0 comments on commit 2f34d0e

Please sign in to comment.