Skip to content

Commit

Permalink
v not needed
Browse files Browse the repository at this point in the history
Signed-off-by: Diogenes Fernandes <[email protected]>
  • Loading branch information
diofeher committed Feb 26, 2025
1 parent 4252f20 commit b8e0ae0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion search/worker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "registry-ui-search",
"version": "0.0.1",
"version": "0.0.0",
"private": true,
"scripts": {
"deploy": "wrangler deploy",
Expand Down
7 changes: 2 additions & 5 deletions search/worker/scripts/feed-data-r2.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit b8e0ae0

Please sign in to comment.