@merkl/api 0.10.414 → 0.10.416
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,11 +36,11 @@ const extract = async () => {
|
|
36
36
|
}
|
37
37
|
if (data.length < MAX_BATCH_SIZE)
|
38
38
|
continue;
|
39
|
-
loadPromises.push(withRetry(load, [data], 5,
|
39
|
+
loadPromises.push(withRetry(load, [data], 5, 10_000));
|
40
40
|
data = [];
|
41
41
|
}
|
42
42
|
// Final batch
|
43
|
-
loadPromises.push(withRetry(load, [data], 5,
|
43
|
+
loadPromises.push(withRetry(load, [data], 5, 10_000));
|
44
44
|
let count = 0;
|
45
45
|
let failed = 0;
|
46
46
|
const promiseResults = await Promise.allSettled(loadPromises);
|
@@ -50,7 +50,7 @@ const extract = async () => {
|
|
50
50
|
else
|
51
51
|
count += x.value;
|
52
52
|
}
|
53
|
-
return { count, failed };
|
53
|
+
return { count, failed, batch: promiseResults.length };
|
54
54
|
};
|
55
55
|
// ─── Transform & Load ────────────────────────────────────────────────────────
|
56
56
|
const load = async (pendings) => {
|
@@ -188,10 +188,11 @@ const updatePendings = async (data) => {
|
|
188
188
|
};
|
189
189
|
// ─────────────────────────────────────────────────────────────────────────────
|
190
190
|
export const main = async () => {
|
191
|
+
log.info(`✅ Running for ${process.env.FILENAME}`);
|
191
192
|
const start = moment().unix();
|
192
193
|
// ─── Start Rewards ETL ───────────────────────────────────────────────
|
193
|
-
const { count, failed } = await extract();
|
194
|
-
log.info(`✅ Successfully created ${count} new records for ${process.env.FILENAME} in ${moment().unix() - start} sec`);
|
194
|
+
const { count, failed, batch } = await extract();
|
195
|
+
log.info(`✅ Successfully created ${count} new records in ${batch} batches for ${process.env.FILENAME} in ${moment().unix() - start} sec`);
|
195
196
|
if (failed !== 0) {
|
196
197
|
log.error("pendings", `${failed} batches failed.`);
|
197
198
|
process.exit(1);
|