MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / refresh

Function refresh

apps/cloud/src/auth/jwks-cache.ts:129–144  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

127 let inflight: Promise<CacheEntry> | null = null;
128
129 const refresh = (): Promise<CacheEntry> => {
130 if (inflight) return inflight;
131 inflight = (async () => {
132 const jwks = await fetchJwksOnce(url, fetchImpl(), timeoutMs);
133 const next: CacheEntry = {
134 jwks,
135 fetchedAt: Date.now(),
136 resolver: createLocalJWKSet(jwks),
137 };
138 entry = next;
139 return next;
140 })().finally(() => {
141 inflight = null;
142 });
143 return inflight;
144 };
145
146 const ensureFresh = async (forceRefresh: boolean): Promise<CacheEntry> => {
147 if (forceRefresh) return refresh();

Callers 1

ensureFreshFunction · 0.70

Calls 2

fetchJwksOnceFunction · 0.85
fetchImplFunction · 0.70

Tested by

no test coverage detected