Closed seeker25 closed 1 year ago
@bolyachevets What do you think?
@bolyachevets What do you think?
it is a good idea. something tells me we will be asked to do reduce the number of calls in the near future.
Pallets (which maintains flask) has a cache library. We already use it to do simple caching, and it can memoize easily enough as well. Does exactly what you're looking for. https://github.com/pallets-eco/cachelib
We should build a generalized solution that can cache service account access tokens.
So we're not requesting a new token each time we have a request coming in.
Ideally this would work outside the flask context if possible. That way we could use these in jobs and queue services etc.
It's also possible to set access token timeouts higher than 2 minutes directly for certain clients.
It might be possible to set it up to 20m and cache all of the tokens.
Also see: https://github.com/bcgov/entity/issues/15233
See #registries-sso-migration for the calls from May 24th.