Skip to content

Commit 2f34d0e

Browse files
separated setupMappings from ping
1 parent 1efbad0 commit 2f34d0e

File tree

1 file changed

+15
-17
lines changed

1 file changed

+15
-17
lines changed

lib/esConnector.js

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -126,25 +126,23 @@ ESConnector.prototype.connect = function (callback) {
126126
if (error) {
127127
console.log('ESConnector.prototype.connect', 'ping', 'failed', error);
128128
log('ESConnector.prototype.connect', 'ping', 'failed', error);
129-
callback(null, self.db);
130-
} else {
131-
if (self.settings.mappingProperties) {
132-
self.setupMappings()
133-
.then(function () {
134-
log('ESConnector.prototype.connect', 'setupMappings', 'finished');
135-
callback && callback(null, self.db);
136-
})
137-
.catch(function (err) {
138-
log('ESConnector.prototype.connect', 'setupMappings', 'failed', err);
139-
callback && callback(null, self.db);
140-
});
141-
} else {
142-
process.nextTick(function () {
143-
callback && callback(null, self.db);
144-
});
145-
}
146129
}
147130
});
131+
if (self.settings.mappingProperties) {
132+
self.setupMappings()
133+
.then(function () {
134+
log('ESConnector.prototype.connect', 'setupMappings', 'finished');
135+
callback && callback(null, self.db);
136+
})
137+
.catch(function (err) {
138+
log('ESConnector.prototype.connect', 'setupMappings', 'failed', err);
139+
callback && callback(null, self.db);
140+
});
141+
} else {
142+
process.nextTick(function () {
143+
callback && callback(null, self.db);
144+
});
145+
}
148146
}
149147
};
150148

0 commit comments

Comments
 (0)