Skip to content

Commit

Permalink
Tidy up datasource
Browse files Browse the repository at this point in the history
  • Loading branch information
raymondfeng committed May 2, 2018
1 parent b89cd0e commit 8a43ce1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/datasource.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ function DataSource(name, settings, modelBuilder) {
}.bind(this));

// define DataAccessObject.prototype methods
Object.keys(dao.prototype).forEach(function(name) {
Object.keys(dao.prototype || []).forEach(function(name) {
var fn = dao.prototype[name];
this.DataAccessObject.prototype[name] = fn;
if (typeof fn === 'function') {
Expand Down Expand Up @@ -2541,6 +2541,7 @@ DataSource.prototype.ready = function(obj, args) {
* @param {Function} [cb] Callback function
*/
DataSource.prototype.ping = function(cb) {
cb = cb || utils.createPromiseCallback();
var self = this;
if (self.connector.ping) {
this.connector.ping(cb);
Expand All @@ -2552,6 +2553,7 @@ DataSource.prototype.ping = function(cb) {
cb(err);
});
}
return cb.promise;
};

/*! The hidden property call is too expensive so it is not used that much
Expand Down

0 comments on commit 8a43ce1

Please sign in to comment.