diff --git a/lib/models/services/cluster-config-service.js b/lib/models/services/cluster-config-service.js index b7711e0f2..548528a55 100644 --- a/lib/models/services/cluster-config-service.js +++ b/lib/models/services/cluster-config-service.js @@ -360,7 +360,7 @@ module.exports = class ClusterConfigService { return AutoIsolationConfig.findByIdAndAssert(clusterId) .tap((cluster) => { const instancesIds = [cluster.instance.toString()] - instancesIds.concat(cluster.requestedDependencies.map(dep => dep.instance.toString())) + .concat(cluster.requestedDependencies.map(dep => dep.instance.toString())) return Promise.map(instancesIds, (instanceId) => rabbitMQ.deleteInstance({ instanceId })) }) .tap(() => { diff --git a/lib/workers/cluster.delete.js b/lib/workers/cluster.delete.js index 59af3095c..798c53970 100644 --- a/lib/workers/cluster.delete.js +++ b/lib/workers/cluster.delete.js @@ -7,6 +7,7 @@ require('loadenv')() const ClusterConfigService = require('models/services/cluster-config-service') const joi = require('utils/joi') +const WorkerStopError = require('error-cat/errors/worker-stop-error') module.exports.jobSchema = joi.object({ cluster: joi.object({ @@ -21,4 +22,7 @@ module.exports.jobSchema = joi.object({ */ module.exports.task = (job) => { return ClusterConfigService.delete(job.cluster.id) + .catch((err) => { + throw new WorkerStopError('Could not delete cluster', { err }) + }) }