From 9687dadddba149205ee397f0db0adb52b4e51d3b Mon Sep 17 00:00:00 2001 From: Nicolas Lepage <19571875+nlepage@users.noreply.github.com> Date: Tue, 10 Dec 2024 07:58:53 +0100 Subject: [PATCH] feat(api): allows choosing container size for refreshing cache --- api/sample.env | 9 +++++++++ api/scripts/generate-cron.js | 9 +++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/api/sample.env b/api/sample.env index 74df93d3fea..4c1b853deee 100644 --- a/api/sample.env +++ b/api/sample.env @@ -40,6 +40,15 @@ REDIS_URL=redis://localhost:6379 # default: none # sample (everyday at 06:30 UTC): CACHE_RELOAD_TIME=30 6 * * * +# Cache reload container size +# +# If not present, a default size is chosen by Scalingo +# +# present: optional +# type: string (S,M,L,XL,2XL) +# default: none +# CACHE_RELOAD_CONTAINER_SIZE=M + # ========= # DATABASES # ========= diff --git a/api/scripts/generate-cron.js b/api/scripts/generate-cron.js index 144045c83b6..73fe0a1f588 100644 --- a/api/scripts/generate-cron.js +++ b/api/scripts/generate-cron.js @@ -3,8 +3,13 @@ const cronContent = { }; if (process.env.CACHE_RELOAD_TIME) { - cronContent.jobs.push({ + const cacheReloadJob = { command: `${process.env.CACHE_RELOAD_TIME} npm run cache:refresh`, - }); + }; + if (process.env.CACHE_RELOAD_CONTAINER_SIZE) { + cacheReloadJob.size = process.env.CACHE_RELOAD_CONTAINER_SIZE; + } + cronContent.jobs.push(cacheReloadJob); } + console.log(JSON.stringify(cronContent));