Skip to content

Commit

Permalink
fix: sorted small bugs picked up by sonar, ref: updated package-lock
Browse files Browse the repository at this point in the history
  • Loading branch information
southbite committed Nov 21, 2017
1 parent 0c8f593 commit 89eb5c8
Show file tree
Hide file tree
Showing 75 changed files with 18 additions and 28,379 deletions.
2 changes: 1 addition & 1 deletion lib/services/publisher/publication.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function Publication(message, options) {

if (!options.acknowledgeTimeout) options.acknowledgeTimeout = 60000;

configurator.setProperty(this, 'publication_options', options || {});
configurator.setProperty(this, 'publication_options', options);

if (this.options.consistency == null) this.options.consistency = CONSISTENCY.TRANSACTIONAL; //by default

Expand Down
12 changes: 6 additions & 6 deletions lib/services/queue/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ util.inherits(QueueService, EventEmitter);

QueueService.prototype.stats = function () {

if (this.__inboundQueue != null) this.statsInternal.inbound = this.__inboundQueue.length;
if (this.__outboundQueue != null) this.statsInternal.outbound = this.__outboundQueue.length;
if (this.__systemQueue != null) this.statsInternal.system = this.__systemQueue.length;
if (this.__publicationQueue != null) this.statsInternal.publication = this.__publicationQueue.length;
if (this.__inboundQueue != null) this.statsInternal.inbound = this.__inboundQueue.length();
if (this.__outboundQueue != null) this.statsInternal.outbound = this.__outboundQueue.length();
if (this.__systemQueue != null) this.statsInternal.system = this.__systemQueue.length();
if (this.__publicationQueue != null) this.statsInternal.publication = this.__publicationQueue.length();

return this.statsInternal;
};
Expand Down Expand Up @@ -77,15 +77,15 @@ QueueService.prototype.initialize = Promise.promisify(function (config, callback

} else {

if (!this.config.concurrency) this.config.concurrency = Infinity;
if (!this.config.concurrency) this.config.concurrency = 100;

if (!this.config.systemConcurrency) this.config.systemConcurrency = 1; //system events are concurrent

if (!this.config.concurrencyIn) this.config.concurrencyIn = this.config.concurrency;

if (!this.config.concurrencyOut) this.config.concurrencyOut = this.config.concurrency;

if (!this.config.concurrencyPublisher) this.config.concurrencyPublisher = this.config.concurrency;
if (!this.config.concurrencyPublisher) this.config.concurrencyPublisher = this.config.concurrency * 10;

//GET SET ON DELETE
this.__inboundQueue = async.queue(this.happn.services.protocol.processMessageIn.bind(this.happn.services.protocol), this.config.concurrencyIn);
Expand Down
22 changes: 2 additions & 20 deletions lib/services/security/checkpoint.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,18 +74,6 @@ CheckPoint.prototype.__createPermissionSet = function (permissions) {
return permissionSet;
};

CheckPoint.prototype.__resolveConflictingPermission = function (compare1, compare2) {
//TODO: conflicting permissions may cause issues here, propose a policy of taking the least lenient permission

if (this.opts.groupPermissionsPolicy == 'least_restrictive') {
//find the least restrictive permission
} else {
//find the most restrictive permission
}

return compare2;
};

CheckPoint.prototype.__loadPermissionSet = function (identity, callback) {

var _this = this;
Expand All @@ -97,14 +85,8 @@ CheckPoint.prototype.__loadPermissionSet = function (identity, callback) {

if (e) return eachCB(e);

for (var permissionPath in group.permissions) {

if (permissions[permissionPath]) {
//we have a conflicting permission
permissions[permissionPath] = _this.__resolveConflictingPermission(permissions[permissionPath], group.permissions[permissionPath]);

} else permissions[permissionPath] = group.permissions[permissionPath];
}
for (var permissionPath in group.permissions)
permissions[permissionPath] = group.permissions[permissionPath];

eachCB();

Expand Down
3 changes: 0 additions & 3 deletions lib/services/security/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,8 @@ SecurityUsers.prototype.__validate = function (validationType, options, obj, cal
if (!result) return callback(new Error('validation error: user does not exist: ' + user._meta.path));

callback();

});
});

return callback();
}

if (obj.name) _this.__validateName(obj.name, validationType);
Expand Down
10 changes: 5 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "happn-3",
"description": "pub/sub api as a service using primus and mongo & redis or nedb, can work as cluster, single process or embedded using nedb",
"version": "5.0.0-alpha.10",
"version": "5.0.0-alpha.11",
"main": "./lib/index",
"protocol": "2",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# must be unique in a given SonarQube instance
sonar.projectKey=happner:happn-3
sonar.projectKey=happn-3
# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=happn-3
sonar.projectVersion=1.0
Expand Down
6 changes: 2 additions & 4 deletions test/c5_client_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,21 +110,19 @@ describe('c5_client_events', function () {

clientInstance.set('/setting/data/before/reconnect', {
test: "data"
}, function (e, response) {
}, function (e) {

if (e) return callback(e);

for (var key in serviceInstance.connections) serviceInstance.connections[key].destroy();

if (e) return callback(e);

setTimeout(function () {

if (e) return callback(e);

clientInstance.set('/setting/data/after/reconnect', {
test: "data"
}, function (e, response) {
}, function (e) {

if (e) return callback(e);
if (eventsFired['reconnect-scheduled'] && eventsFired['reconnect-successful']) return callback();
Expand Down
3 changes: 0 additions & 3 deletions test/d3_security_tokens.js
Original file line number Diff line number Diff line change
Expand Up @@ -660,9 +660,6 @@ describe('d3-security-tokens', function () {
'/test/group/explicit': {
action: ['set']
},
'/test/group/*': {
action: ['*']
},
'/test/group/*': {
action: ['*']
}
Expand Down
2 changes: 0 additions & 2 deletions test/d8_session_management_unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,6 @@ describe('d8_session_management', function () {

happn.services.session.attachSession(session.id, session);

if (e) return done(e);

happn.services.security.listActiveSessions(function (e, list) {

if (e) return done(e);
Expand Down

0 comments on commit 89eb5c8

Please sign in to comment.