Skip to content

Commit

Permalink
fix: postgres max call
Browse files Browse the repository at this point in the history
  • Loading branch information
Victor Zeinstra committed Jul 24, 2023
1 parent 7e030e8 commit c1ef85f
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions targets/ingester/src/articles/update-kali-articles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,28 @@ export const updateKaliArticles = async (): Promise<void> => {
const { agreements } = await loadAgreements();

let i = 0;
await Promise.all(
await pMap(
agreements,
async ({ idcc, kali_id }) => {
console.log(
`updateKaliData: ${++i}/${
agreements.length
} Updating agreement for IDCC ${idcc}`
);
const articles = await loadAgreementArticles(
kali_id,
idcc,
loadAgreement,
loadArticles
);
await updateAgreementArticles(idcc, articles);
},
{
concurrency: 10,
}
)
const promises = await pMap(
agreements,
async ({ idcc, kali_id }) => {
console.log(
`updateKaliData: ${++i}/${
agreements.length
} Updating agreement for IDCC ${idcc}`
);
const articles = await loadAgreementArticles(
kali_id,
idcc,
loadAgreement,
loadArticles
);
await updateAgreementArticles(idcc, articles);
},
{
concurrency: 10,
}
);
await promises.reduce(async (previousPromise, process) => {
await previousPromise;
return await process;
}, Promise.resolve());
};

0 comments on commit c1ef85f

Please sign in to comment.