Surface Retry-After header in error envelope for rate-limited responses

Đang mở
#777 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

  • #802 của @Lubrsy706 — đã đóng, không merge
  • #809 của @Lubrsy706 — đã đóng, không merge

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
rust
Lĩnh vực
api, cli

Hướng nghiên cứu

No source file or test is named. Start by locating the gws HTTP error-envelope handling and existing tests for forwarded API errors; then determine where Retry-After is available and how error fields are serialized. Done means 429, rate-limit 403, 500, and 503 responses preserve the header as seconds-from-now, while responses without it remain unchanged.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Feature request

When a Calendar API call returns a rate-limit response (HTTP 429, or 403 with reason rateLimitExceeded / userRateLimitExceeded), Google often returns a Retry-After response header indicating when the client may safely retry. Currently gws does not surface that header value to callers - the error JSON it forwards on stderr only carries Google's standard error envelope:

{"error":{"code":429,"message":"...","errors":[{"reason":"rateLimitExceeded"}]}}

Downstream tools that wrap gws for retry have no way to honor Retry-After and must fall back to a fixed exponential schedule.

Suggested shape

Add retry_after_seconds (or retryAfter - whatever fits gws conventions) to the error envelope when the response carried a Retry-After header. Empty/absent when the header was not present.

{"error":{"code":429,"message":"...","errors":[{"reason":"rateLimitExceeded"}],"retryAfterSeconds":17}}

Or, alternatively, a top-level sibling field outside error:

{"error":{...},"retryAfterSeconds":17}

The header can be either an integer number of seconds OR an HTTP-date; gws should normalize to seconds-from-now to keep downstream parsing simple.

This would also be useful for 500/503 responses, where Google sometimes returns Retry-After to throttle clients during incidents.

Notes

  • Header name in Google's responses is Retry-After. RFC 7231 §7.1.3.
  • Calendar API documents the header in their usage limits and rate-limiting docs.
  • No security or backwards-compat concern - this is purely additive to the error envelope.
Ngôn ngữ chính
Rust
Star
32.3k
Fork
2k
Merge trung bình
16 giờ 3 phút
Pull request đã merge (30 ngày)
1

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của googleworkspace/cli

Tất cả issue của googleworkspace/cli

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.