@merkl/api 0.10.409 → 0.10.411
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.
@@ -5,8 +5,6 @@ import { log } from "../../utils/logger";
|
|
5
5
|
import { apiDbClient } from "../../utils/prisma";
|
6
6
|
import { S3Client } from "bun";
|
7
7
|
import moment from "moment";
|
8
|
-
// ─── Constants ───────────────────────────────────────────────
|
9
|
-
const BATCH_SIZE = 5_000;
|
10
8
|
// ─── Global Variables ────────────────────────────────────────
|
11
9
|
const [chainIdString, root, campaignId] = process.env.FILENAME.split("_");
|
12
10
|
const chainId = Number.parseInt(chainIdString);
|
@@ -16,7 +14,7 @@ const gcsClient = new S3Client({
|
|
16
14
|
endpoint: process.env.GCS_ENDPOINT,
|
17
15
|
bucket: `merkl-rewards-lake-${process.env.ENV}`,
|
18
16
|
});
|
19
|
-
const file = gcsClient.file(process.env.FILENAME);
|
17
|
+
const file = gcsClient.file(`pendings/${process.env.FILENAME}`);
|
20
18
|
const failedBatches = [];
|
21
19
|
// ─── Extract ─────────────────────────────────────────────────────────────────
|
22
20
|
const extract = async () => {
|
@@ -33,16 +31,14 @@ const extract = async () => {
|
|
33
31
|
buffer = lines.pop() || "";
|
34
32
|
for (const line of lines) {
|
35
33
|
data.push(JSON.parse(line));
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
}
|
45
|
-
}
|
34
|
+
}
|
35
|
+
try {
|
36
|
+
count += await load(data);
|
37
|
+
}
|
38
|
+
catch (err) {
|
39
|
+
console.error(`Failed to insert a batch, adding it to the fail queue.\n${err}`);
|
40
|
+
failedBatches.push(data);
|
41
|
+
data.length = 0;
|
46
42
|
}
|
47
43
|
}
|
48
44
|
return count;
|
@@ -196,8 +192,8 @@ export const main = async () => {
|
|
196
192
|
process.exit(1);
|
197
193
|
}
|
198
194
|
if (failedBatches.length === 0) {
|
199
|
-
await file.delete();
|
200
|
-
log.info("Object deleted");
|
195
|
+
// await file.delete();
|
196
|
+
// log.info("Object deleted");
|
201
197
|
}
|
202
198
|
};
|
203
199
|
main();
|