Skip to content

Commit

Permalink
refactor: do not store policies in global cache in hot mode
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Apr 26, 2024
1 parent 82d7f4b commit 123d662
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/policy_authorizer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export class PolicyAuthorizer<
/**
* Read from cache if exists
*/
if (KNOWN_POLICIES_CACHE.has(this.#policyImporter) && !('hot' in import.meta)) {
if (KNOWN_POLICIES_CACHE.has(this.#policyImporter)) {
debug('reading policy from the imports cache %O', this.#policyImporter)
return KNOWN_POLICIES_CACHE.get(this.#policyImporter)!
}
Expand All @@ -128,7 +128,9 @@ export class PolicyAuthorizer<
/**
* Cache the resolved value
*/
KNOWN_POLICIES_CACHE.set(this.#policyImporter, this.#policy)
if (!('hot' in import.meta)) {
KNOWN_POLICIES_CACHE.set(this.#policyImporter, this.#policy)
}
return this.#policy
}

Expand Down

0 comments on commit 123d662

Please sign in to comment.