@5minds/node-red-contrib-processcube
Advanced tools
Comparing version 1.6.0-process-instance-delete-hotfix-8e3137-m4vfvc9z to 1.6.0-process-instance-delete-hotfix-91ecee-m4wjipwd
{ | ||
"name": "@5minds/node-red-contrib-processcube", | ||
"version": "1.6.0-process-instance-delete-hotfix-8e3137-m4vfvc9z", | ||
"version": "1.6.0-process-instance-delete-hotfix-91ecee-m4wjipwd", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "description": "Node-RED nodes for ProcessCube", |
@@ -46,12 +46,11 @@ module.exports = function (RED) { | ||
const batchSize = config.batch_size || 100; | ||
const batchSize = msg.payload.batch_size || config.batch_size; | ||
try { | ||
const result = await client.processInstances.query( | ||
{ | ||
{ | ||
processModelId: modelId, | ||
finishedAfter: deletionDate.toISOString(), | ||
finishedBefore: deletionDate.toISOString(), | ||
state: ["finished", "error", "terminated"], | ||
}, | ||
{ identity: node.engine.identity } | ||
} | ||
); | ||
@@ -70,10 +69,11 @@ | ||
for (let i = 0; i < ids.length; i += batchSize) { | ||
const batch = ids.slice(i, i + batchSize); | ||
try { | ||
var batch = ids.slice(i, i + batchSize); | ||
try | ||
{ | ||
await client.processInstances.deleteProcessInstances(batch, true, node.engine.identity); | ||
msg.payload.successfulDeletions.push(...batch); | ||
} catch (deleteError) { | ||
batch.forEach((id) => { | ||
msg.payload.failedDeletions.push({ id, error: deleteError.message }); | ||
}); | ||
} | ||
catch (deleteError) | ||
{ | ||
batch.forEach((id) => {msg.payload.failedDeletions.push({ id, error: deleteError.message });}); | ||
node.warn(`Failed to delete process instances in batch for Model-ID: ${modelId}: ${batch.join(', ')}. Error: ${deleteError.message}`); | ||
@@ -80,0 +80,0 @@ } |
515779