Skip to content

Commit

Permalink
add logs
Browse files Browse the repository at this point in the history
  • Loading branch information
folland87 committed Dec 9, 2024
1 parent 4b7b569 commit 6770094
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/jobs/sirene/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ export default async function monitorSiren(job) {
if (!from) return { status: "failed", message: "No previous execution" };

const siretStockFromPaysage = await getSiretStockFromPaysage();
console.log("STOCK", siretStockFromPaysage.length, siretStockFromPaysage);

const updatesInSirene = await fetchSireneUpdates(from, until);
console.log("SIRENE", updatesInSirene.length, updatesInSirene);

const stockToBeUpdated = siretStockFromPaysage.filter(({ siret }) =>
updatesInSirene.some((update) => update.siret === siret),
);
console.log(stockToBeUpdated?.length, stockToBeUpdated);
console.log("UPDATES", stockToBeUpdated?.length, stockToBeUpdated);
const stockUpdates = [];
for (const stockElement of stockToBeUpdated) {
const siretData = await fetchSiretDataById(stockElement.siret);
Expand All @@ -51,6 +53,7 @@ export default async function monitorSiren(job) {
return {
status: "success",
message: "Nothing to update",
lastExecution: now,
from,
until,
stockUpdates,
Expand Down

0 comments on commit 6770094

Please sign in to comment.