Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add report mechanism (storing, APIs and report build) #433

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Added global error catch for legacy compose
antoineludeau committed Jul 31, 2024
commit ae588a6bff3ded2774c5682854c5e63ebeec2a0a
20 changes: 12 additions & 8 deletions lib/jobs/compose-commune.cjs
Original file line number Diff line number Diff line change
@@ -3,18 +3,22 @@ const {getCommune, finishComposition} = require('../models/commune.cjs')
const composeCommune = require('../compose/index.cjs')

async function handle({data: {codeCommune, compositionAskedAt, ignoreIdConfig}}) {
const communeEntry = await getCommune(codeCommune)
try {
const communeEntry = await getCommune(codeCommune)

if (!communeEntry.compositionAskedAt || !isEqual(communeEntry.compositionAskedAt, parseISO(compositionAskedAt))) {
return
}
if (!communeEntry.compositionAskedAt || !isEqual(communeEntry.compositionAskedAt, parseISO(compositionAskedAt))) {
return
}

console.log(`Composition des adresses de la commune ${codeCommune}`)
console.log(`Composition des adresses de la commune ${codeCommune}`)

await composeCommune(codeCommune, ignoreIdConfig)
await finishComposition(codeCommune)
await composeCommune(codeCommune, ignoreIdConfig)
await finishComposition(codeCommune)

console.log(`Composition des adresses de la commune ${codeCommune} terminée`)
console.log(`Composition des adresses de la commune ${codeCommune} terminée`)
} catch (error) {
console.error(`Erreur lors de la composition de la commune ${codeCommune}`, error)
}
}

module.exports = handle