mirror of
https://github.com/catdevnull/preciazo.git
synced 2024-11-25 19:16:19 +00:00
retry
This commit is contained in:
parent
2d6804a409
commit
8729bb0108
1 changed files with 9 additions and 5 deletions
|
@ -32,11 +32,15 @@ const s3 = new S3Client({
|
||||||
});
|
});
|
||||||
|
|
||||||
async function getRawDatasetInfo() {
|
async function getRawDatasetInfo() {
|
||||||
const response = await fetchWithRetry(
|
try {
|
||||||
"https://datos.produccion.gob.ar/api/3/action/package_show?id=sepa-precios",
|
const response = await fetchWithRetry(
|
||||||
);
|
"https://datos.produccion.gob.ar/api/3/action/package_show?id=sepa-precios",
|
||||||
const json = await response.json();
|
);
|
||||||
return json;
|
return await response.json();
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`❌ Error fetching dataset info`, error, `retrying in 5min...`);
|
||||||
|
await new Promise((resolve) => setTimeout(resolve, 5 * 60 * 1000));
|
||||||
|
return await getRawDatasetInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function saveDatasetInfoIntoRepo(datasetInfo: any) {
|
async function saveDatasetInfoIntoRepo(datasetInfo: any) {
|
||||||
|
|
Loading…
Reference in a new issue