Cache requests to .well-known/openid_configuration/
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 68/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- python
- Lĩnh vực
- api, authentication
Hướng nghiên cứu
Bắt đầu từ get_discovery_doc và đường dẫn khởi tạo AuthClient được mô tả trong issue, sau đó kiểm tra cách discovery document hiện được yêu cầu và gắn vào Session. Xác nhận rằng việc khởi tạo AuthClient lặp lại sẽ sử dụng lại các kết quả discovery đã được lưu trong bộ nhớ đệm mà không yêu cầu session, đồng thời kiểm tra rằng bộ test hiện có bao phủ hành vi này.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
(related to https://github.com/intuit/oauth-pythonclient/issues/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 https://github.com/intuit/oauth-pythonclient/issues/47,
Solution
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_docwith asessionarg -- it's a static resource that you can access without any auth. - Annotate
get_discovery_docwith@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?
- Ngôn ngữ chính
- Python
- Star
- 86
- Fork
- 59
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của intuit/oauth-pythonclient
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
intuit/oauth-pythonclient#56 ·
-
input Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 10/100
intuit/oauth-pythonclient#55 · 2 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
intuit/oauth-pythonclient#47 · 1 bình luận · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 20/100
intuit/oauth-pythonclient#38 · 3 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
intuit/oauth-pythonclient#37 · 1 bình luận ·
Tất cả issue của intuit/oauth-pythonclient
Issue tương tự
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
canonical/paas-charm#368 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
tech debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
addition to tracking list Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
StevenBlack/hosts#3256 ·
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100
qualcomm/qai-appbuilder#275 ·