Skip to content

Commit

Permalink
fixup post reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Oct 15, 2024
1 parent 49b52c1 commit 1048e28
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
18 changes: 8 additions & 10 deletions lib/api/BackbeatAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -1263,7 +1263,6 @@ class BackbeatAPI {
if (this._config.queuePopulator.mongo) {
return this._setupLocationStatusManager(cb);
} else {
this._logger.debug('BackbeatAPI setup ready without Mongo');
return cb();
}
});
Expand Down Expand Up @@ -1307,8 +1306,13 @@ class BackbeatAPI {
* @returns {undefined} undefined
*/
_setupMongoClient(cb) {
if (this._config.queuePopulator.mongo) {
const mongoConfig = this._config.queuePopulator.mongo;
const mongoConfig = this._config.queuePopulator.mongo;
if (!mongoConfig) {
this._logger.debug('MongoDB configuration not found, skipping MongoDB client setup', {
method: 'BackbeatAPI._setupMongoClient',
});
return cb();
} else {
const mongoUrl = constructConnectionString(mongoConfig);
return MongoClient.connect(mongoUrl, {
replicaSet: mongoConfig.replicaSet,
Expand All @@ -1331,11 +1335,6 @@ class BackbeatAPI {
});
return cb();
});
} else {
this._logger.debug('MongoDB configuration not found, skipping MongoDB client setup', {
method: 'BackbeatAPI._setupMongoClient',
});
return cb();
}
}

Expand Down Expand Up @@ -1367,12 +1366,11 @@ class BackbeatAPI {
return this._locationStatusManager._setupLocationStatusStore(err => {
if (err) {
this._logger.error('error setting up location status manager', {

Check warning on line 1368 in lib/api/BackbeatAPI.js

View check run for this annotation

Codecov / codecov/patch/Backbeat

lib/api/BackbeatAPI.js#L1368

Added line #L1368 was not covered by tests
method: 'BackbeatAPI.setupInternals',
method: 'BackbeatAPI._setupLocationStatusManager',
error: err.message,
});
return cb(err);
}
this._logger.info('BackbeatAPI setup ready');
return cb();
});
}
Expand Down
1 change: 0 additions & 1 deletion tests/unit/api/BackbeatAPI.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ describe('BackbeatAPI', () => {
assert(setupMongoClientStub.calledOnce);
assert(setProducerStub.calledThrice);
assert(setupLocationStatusManagerStub.notCalled);
assert(debugSpy.calledWith('BackbeatAPI setup ready without Mongo'));
done();
});
});
Expand Down

0 comments on commit 1048e28

Please sign in to comment.