From b8e0ae08fb6b837dd73c4671980d060f1c21e528 Mon Sep 17 00:00:00 2001 From: Diogenes Fernandes Date: Wed, 26 Feb 2025 15:22:20 -0300 Subject: [PATCH] v not needed Signed-off-by: Diogenes Fernandes --- search/worker/package.json | 2 +- search/worker/scripts/feed-data-r2.js | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/search/worker/package.json b/search/worker/package.json index cdbe546..4f47e5c 100644 --- a/search/worker/package.json +++ b/search/worker/package.json @@ -1,6 +1,6 @@ { "name": "registry-ui-search", - "version": "0.0.1", + "version": "0.0.0", "private": true, "scripts": { "deploy": "wrangler deploy", diff --git a/search/worker/scripts/feed-data-r2.js b/search/worker/scripts/feed-data-r2.js index 4d66153..7da7a9f 100755 --- a/search/worker/scripts/feed-data-r2.js +++ b/search/worker/scripts/feed-data-r2.js @@ -10,8 +10,6 @@ const readdir = promisify(fs.readdir); // This script is used to retrieve data generated by `go run generate.go` at backend folder. // It will generate registry data that will be used by this script to feed into wrangler dev folder, mimicking a R2 bucket. // This script expects data will be at /tmp/registry. - -const BATCH_SIZE = 2 const DIR_PATH = '/tmp/registry'; const putObject = (directoryPath) => async (filename, i) => { @@ -20,7 +18,7 @@ const putObject = (directoryPath) => async (filename, i) => { try { const stats = await stat(realFilePath) - // directories are not supported by wrangler api and + // Directories are not supported by `wrangler r2` API and // not needed since wrangler create the path without using folders. if(stats.isDirectory()) return } catch(err) { @@ -47,9 +45,8 @@ const run = async () => { console.log(`Reading ${DIR_PATH}...`) const files = await readdir(DIR_PATH, { recursive: true }); const total = files.length; - const batches = Math.ceil(total / BATCH_SIZE); - console.log(`Processing about ${total} files/folders in ${batches} batches...`); + console.log(`Processing about ${total} files/folders...`); // We're processing sequentially because wranger r2 put doesn't handle // well concurrency giving a lot of errors, even with 2 files at once. for(const f of files) {