Skip to content

Commit b6f9583

Browse files
committed
fixup! unique file name
1 parent be8b697 commit b6f9583

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/cloudflare/src/cli/commands/populate-cache.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import fs from "node:fs";
2+
import fsp from "node:fs/promises";
23
import os from "node:os";
34
import path from "node:path";
45

@@ -239,8 +240,8 @@ async function populateR2IncrementalCache(
239240
file: fullPath,
240241
}));
241242

242-
const listFile = path.join(os.tmpdir(), `r2-bulk-list.json`);
243-
243+
const tempDir = await fsp.mkdtemp(path.join(os.tmpdir(), "open-next-"));
244+
const listFile = path.join(tempDir, `r2-bulk-list.json`);
244245
fs.writeFileSync(listFile, JSON.stringify(objectList));
245246

246247
const concurrency = Math.max(1, populateCacheOptions.cacheChunkSize ?? 50);
@@ -287,8 +288,10 @@ async function populateKVIncrementalCache(
287288

288289
logger.info(`Inserting ${assets.length} assets to KV in chunks of ${chunkSize}`);
289290

291+
const tempDir = await fsp.mkdtemp(path.join(os.tmpdir(), "open-next-"));
292+
290293
for (const i of tqdm(Array.from({ length: totalChunks }, (_, i) => i))) {
291-
const chunkPath = path.join(buildOpts.outputDir, "cloudflare", `cache-chunk-${i}.json`);
294+
const chunkPath = path.join(tempDir, `cache-chunk-${i}.json`);
292295

293296
const kvMapping = assets
294297
.slice(i * chunkSize, (i + 1) * chunkSize)

0 commit comments

Comments
 (0)