Skip to content

Commit

Permalink
optimize callCallbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
hobbyquaker committed Feb 5, 2019
1 parent 1b61a07 commit 4a6feed
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions nodes/ccu-connection.js
Original file line number Diff line number Diff line change
Expand Up @@ -2091,11 +2091,6 @@ module.exports = function (RED) {
const {filter, callback} = this.callbacks[id];
//this.logger.trace('filter', JSON.stringify(filter));

if (this.callbackBlacklists[msg.datapointName].has(id)) {
//this.logger.trace('blacklistet ' + id + ' ' + msg.datapointName);
return false;
}

let match = true;
let matchCache;
let matchChange;
Expand All @@ -2104,7 +2099,7 @@ module.exports = function (RED) {
if (filter) {
const arrAttr = Object.keys(filter);

for (let i = 0, len = arrAttr.length; match && i < len; i++) {
for (let i = 0, len = arrAttr.length; match && (i < len); i++) {
const attr = arrAttr[i];

if (attr === 'cache') {
Expand Down Expand Up @@ -2196,6 +2191,10 @@ module.exports = function (RED) {
this.callbackWhitelists[msg.datapointName] = new Set();
}
Object.keys(this.callbacks).forEach(key => {
if (this.callbackBlacklists[msg.datapointName].has(key)) {
//this.logger.trace('blacklistet ' + key + ' ' + msg.datapointName);
return;
}
this.callCallback(msg, key);
});
}
Expand Down

0 comments on commit 4a6feed

Please sign in to comment.