4 ms·
Yeah, I think we need to introduce some sort of API for caching parsed objects in a way that avoids all the caveats of using globals...
by kentonv 4y ago
Yeah, I think we need to introduce some sort of API for caching parsed objects in a way that avoids all the caveats of using globals...
- _panva 4y agoHi, @panva here. I've previously had Erwin effectively propose the existing code (not the one from the linked article, the one that's in the library today https://github.com/panva/jose/blob/v4.13.0/src/jwks/remote.ts#L106-L118 https://github.com/panva/jose/blob/v4.13.0/src/jwks/remote.t...) acknowledging that there is an even more unlikely edge case. Well, someone was bound to hit that second edge case. But please help me out on this, the code does not await the _pendingFetch promise and neither does it touch any runtime globals. So what gives? Please reach out on the cloudflare discord PanvA#6705.
- kentonv 4y agoThe code will usually work, but it's possible that the request which initializes `_pendingFetch` gets canceled before the fetch completes, in which case all other requests will loop forever waiting for it.