Skip to content
This repository has been archived by the owner on Sep 16, 2024. It is now read-only.

Commit

Permalink
fix(env): allow an env var for cache backup interval
Browse files Browse the repository at this point in the history
  • Loading branch information
dtfiedler committed Apr 16, 2024
1 parent 2af8972 commit 8f05104
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ import pLimit from 'p-limit';
const bucket = process.env.WARP_CACHE_BUCKET || 'arns-warp-cache';
const cacheDirectory = process.env.WARP_CACHE_KEY || 'cache';
const region = process.env.AWS_REGION || 'us-west-2';
const s3CacheIntervalMs = +(
process.env.S3_CACHE_INTERVAL_MS || 3 * 60 * 60 * 1000
);
const s3 = new S3Client({
region,
});
Expand All @@ -53,7 +56,7 @@ export const bootstrapCache = async () => {

if (SAVE_CACHE_TO_S3) {
// save the cache on a 3 hour interval
setInterval(saveCacheToS3, 3 * 60 * 60 * 1000);
setInterval(saveCacheToS3, s3CacheIntervalMs);
}
};

Expand Down

0 comments on commit 8f05104

Please sign in to comment.