diff --git a/server/src/jobs/database/fixDiffusibleCompanies.ts b/server/src/jobs/database/fixDiffusibleCompanies.ts index 964f01f385..0517b81a07 100644 --- a/server/src/jobs/database/fixDiffusibleCompanies.ts +++ b/server/src/jobs/database/fixDiffusibleCompanies.ts @@ -57,7 +57,7 @@ export async function fixDiffusibleCompanies(): Promise { export async function checkDiffusibleCompanies(): Promise { logger.info(`Checking diffusible sirets`) - const sirets: AsyncIterable = await db.collection("tmp_siret").find({}) + const sirets: AsyncIterable<{ _id: string }> = await db.collection("tmp_siret").find({}) let count = 0 let nonDiffusibleCount = 0 @@ -65,15 +65,16 @@ export async function checkDiffusibleCompanies(): Promise { let unavailableCount = 0 let notFoundCount = 0 let errorCount = 0 - for await (const siret of sirets) { - if (count % 500 === 0) { + + for await (const { _id } of sirets) { + if (count % 100 === 0) { logger.info( `${count} sirets checked. ${partiellementDiffusibleCount} partDiff. ${unavailableCount} indisp. ${notFoundCount} non trouvé. ${nonDiffusibleCount} nonDiff. ${errorCount} errors` ) } count++ try { - const isDiffusible = await getDiffusionStatus(siret) + const isDiffusible = await getDiffusionStatus(_id) switch (isDiffusible) { case EDiffusibleStatus.NON_DIFFUSIBLE: { diff --git a/server/src/services/etablissement.service.ts b/server/src/services/etablissement.service.ts index 11457d872a..1f8c08144e 100644 --- a/server/src/services/etablissement.service.ts +++ b/server/src/services/etablissement.service.ts @@ -286,12 +286,11 @@ export const getEtablissementDiffusionStatus = async (siret: string): Promise