Skip to content

Commit

Permalink
feat(api): allows choosing container size for refreshing cache
Browse files Browse the repository at this point in the history
  • Loading branch information
nlepage committed Dec 10, 2024
1 parent 07da267 commit b9dfbb6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 9 additions & 0 deletions api/sample.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
# =========
Expand Down
9 changes: 7 additions & 2 deletions api/scripts/generate-cron.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));

0 comments on commit b9dfbb6

Please sign in to comment.