node-red-contrib-simple-queue
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -8,3 +8,3 @@ { | ||
}, | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"license": "MIT", | ||
@@ -11,0 +11,0 @@ "keywords": [ |
@@ -7,4 +7,15 @@ const {v4: uuidv4} = require('uuid'); | ||
this.count = config.count||4; | ||
this.unique_check = config.unique_check||undefined; | ||
this.waiting = []; | ||
this.queue = []; | ||
this.unique_index = {}; | ||
RED.events.on('runtime-event', (e) => { | ||
if(e.id==='project-update') { | ||
console.log(e); | ||
console.log(RED.settings.userDir); | ||
} | ||
}); | ||
let node = this; | ||
@@ -38,2 +49,6 @@ | ||
node.queue.splice(idx, 1); | ||
// If we have unique check enabled remove it from the list | ||
if(node.unique_check) { | ||
delete node.unique_index[msg.queue_msg_id]; | ||
} | ||
dequeueMessages(); | ||
@@ -48,2 +63,13 @@ } else { | ||
if(node.unique_check) { | ||
// Make sure its not in our unique list | ||
const key = m[node.unique_check]; | ||
if(!key || Object.values(node.unique_index).indexOf(key) === -1) { | ||
node.unique_index[m.queue_msg_id] = key; | ||
} else { | ||
// Key is already in the queue or under processing, skip it | ||
return; | ||
} | ||
} | ||
if(node.queue.length < config.count) { | ||
@@ -50,0 +76,0 @@ // Still place in queue |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
34398
78