@merkl/api 0.10.410 → 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);
         | 
| @@ -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;
         | 
| @@ -197,7 +193,7 @@ export const main = async () => { | |
| 197 193 | 
             
                }
         | 
| 198 194 | 
             
                if (failedBatches.length === 0) {
         | 
| 199 195 | 
             
                    // await file.delete();
         | 
| 200 | 
            -
                    log.info("Object deleted");
         | 
| 196 | 
            +
                    // log.info("Object deleted");
         | 
| 201 197 | 
             
                }
         | 
| 202 198 | 
             
            };
         | 
| 203 199 | 
             
            main();
         |