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

Commit

Permalink
fix(ao): separate evaluation interval from TTL cache
Browse files Browse the repository at this point in the history
This will allow operators to set how long they want the serve records out of the cahce. Doing so will prevent records from deleted if there are temporary evaluation issues so names will still resolve Until the next evalution period.
  • Loading branch information
dtfiedler committed Jun 26, 2024
1 parent eb72820 commit 163abb9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ export const EVALUATION_INTERVAL_MS = +env.varOrDefault(
'EVALUATION_INTERVAL_MS',
`${1000 * 60 * 15}`, // 15 mins by default
);
export const RESOLVER_CACHE_TTL_MS = +env.varOrDefault(
'RESOLVER_CACHE_TTL_MS',
`${1000 * 60 * 60}`, // 1 hour by default
);
export const RUN_RESOLVER = env.varOrDefault('RUN_RESOLVER', 'true') === 'true';
export const ENABLE_OPENAPI_VALIDATION =
env.varOrDefault('ENABLE_OPENAPI_VALIDATION', 'true') === 'true';
Expand Down
2 changes: 1 addition & 1 deletion src/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const contract: AoIORead = IO.init({
// TODO: this could be done using any KV store - or in memory. For now, we are using LMDB for persistence.
export const cache = new LmdbKVStore({
dbPath: config.ARNS_CACHE_PATH,
ttlSeconds: config.EVALUATION_INTERVAL_MS / 1000,
ttlSeconds: config.RESOLVER_CACHE_TTL_MS / 1000,
});

const parallelLimit = pLimit(100);
Expand Down

0 comments on commit 163abb9

Please sign in to comment.