Skip to content

Commit

Permalink
Prevent udata-sync-all from failing
Browse files Browse the repository at this point in the history
  • Loading branch information
tusbar committed Dec 11, 2018
1 parent df62a75 commit 33f0b7f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion plugins/publish-to-udata/jobs/udata-sync-all/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ const mongoose = require('mongoose')
const Bluebird = require('bluebird')
const debug = require('debug')('geoplatform:udata:jobs:udata-sync-all')

const sentry = require('../../../../lib/utils/sentry')

const {getPublications, unsetRecordPublication} = require('../../geogw')

const Dataset = mongoose.model('Dataset')
Expand Down Expand Up @@ -29,6 +31,12 @@ exports.handler = async function ({data}) {
})

return Promise.all(
[...publishedRecordIds].map(recordId => unsetRecordPublication(recordId))
[...publishedRecordIds].map(async recordId => {
try {
await unsetRecordPublication(recordId)
} catch (error) {
sentry.captureException(error)
}
})
)
}

0 comments on commit 33f0b7f

Please sign in to comment.