You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
.well-known/openid_configuration/ is a stable resource that is not expected to change between requests. If a caller constructs an AuthClient on every request (which I presume is quite common), then they will hit this endpoint, incurring latency costs and potential for failure. Given the latency on this endpoint, I would imagine these duplicate requests are not cheap to Intuit either.
Currently get_discovery_doc is called each time an AuthClient is constructed, and attached to the Session extended by AuthClient
I would propose instead:
Do not call get_discovery_doc with a session arg -- it's a static resource that you can access without any auth.
Annotate get_discovery_doc with @lru_cache(docs) to cache results in-memory for each set of arguments. This is a python builtin.
Happy to contribute a PR for this if interested. I imagine this will provide pretty major cost savings to both Intuit (due to dramatic reduction in duplicate requests) and callers (due to saved compute and less network congestion)
@robert-mings If contributed, would you be open to something like this?
The text was updated successfully, but these errors were encountered:
(related to #18)
Summary
.well-known/openid_configuration/
is a stable resource that is not expected to change between requests. If a caller constructs an AuthClient on every request (which I presume is quite common), then they will hit this endpoint, incurring latency costs and potential for failure. Given the latency on this endpoint, I would imagine these duplicate requests are not cheap to Intuit either.This redundancy exacerbates issues like #47,
Solution
Currently
get_discovery_doc
is called each time anAuthClient
is constructed, and attached to theSession
extended byAuthClient
I would propose instead:
get_discovery_doc
with asession
arg -- it's a static resource that you can access without any auth.get_discovery_doc
with@lru_cache
(docs) to cache results in-memory for each set of arguments. This is a python builtin.Happy to contribute a PR for this if interested. I imagine this will provide pretty major cost savings to both Intuit (due to dramatic reduction in duplicate requests) and callers (due to saved compute and less network congestion)
@robert-mings If contributed, would you be open to something like this?
The text was updated successfully, but these errors were encountered: