Skip to main content
Sign in
Snippets Groups Projects
Commit 7c80a97d authored by Emmanuel Raviart's avatar Emmanuel Raviart
Browse files

Don't fail when simulations_budget/index.json doesn't exist

parent b1753dfe
Branches
Tags 0.0.538
No related merge requests found
Pipeline #11367 passed
...@@ -7,6 +7,7 @@ const { simulationsBudgetDir } = config ...@@ -7,6 +7,7 @@ const { simulationsBudgetDir } = config
// Remove private budget simulations from index. // Remove private budget simulations from index.
const indexFilePath = path.join(simulationsBudgetDir, "index.json") const indexFilePath = path.join(simulationsBudgetDir, "index.json")
if (fs.pathExistsSync(indexFilePath)) {
const publicSimulationsSummary = ( const publicSimulationsSummary = (
fs.readJsonSync(indexFilePath) as Array<{ public: boolean }> fs.readJsonSync(indexFilePath) as Array<{ public: boolean }>
).filter((summary) => summary.public) ).filter((summary) => summary.public)
...@@ -14,6 +15,7 @@ fs.writeJsonSync(indexFilePath, publicSimulationsSummary, { ...@@ -14,6 +15,7 @@ fs.writeJsonSync(indexFilePath, publicSimulationsSummary, {
encoding: "utf-8", encoding: "utf-8",
spaces: 2, spaces: 2,
}) })
}
// Remove every budget simulations from cache. // Remove every budget simulations from cache.
for (const dirName of await fs.readdir(simulationsBudgetDir)) { for (const dirName of await fs.readdir(simulationsBudgetDir)) {
... ...
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment