Skip to content

Commit

Permalink
Add catch to delete
Browse files Browse the repository at this point in the history
fix concat
  • Loading branch information
Nathan219 committed Jul 6, 2017
1 parent 19c7608 commit 06684fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/models/services/cluster-config-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down
4 changes: 4 additions & 0 deletions lib/workers/cluster.delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand All @@ -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 })
})
}

0 comments on commit 06684fd

Please sign in to comment.