Skip to content

Commit 8916a02

Browse files
authored
fix: use unique temporary indices (#155)
1 parent 750374c commit 8916a02

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

gatsby-node.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,12 @@ async function runIndexQueries(
182182
);
183183

184184
let index = client.initIndex(indexName);
185-
const tempIndex = client.initIndex(`${indexName}_tmp`);
186185

187-
if (!await indexExists(index)) {
188-
index = await createIndex(index)
186+
const randomTemp = `temp${Math.floor(Math.random() * 100 + 1)}`;
187+
const tempIndex = client.initIndex(`${indexName}_${randomTemp}`);
188+
189+
if (!(await indexExists(index))) {
190+
index = await createIndex(index);
189191
}
190192

191193
const indexToUse = await getIndexToUse({

0 commit comments

Comments
 (0)