Closed kfcampbell closed 3 months ago
š Hi! Thank you for this contribution! Just to let you know, our GitHub SDK team does a round of issue and PR reviews twice a week, every Monday and Friday! We have a process in place for prioritizing and responding to your input. Because you are a part of this community please feel free to comment, add to, or pick up any issues/PRs that are labled with Status: Up for grabs
. You & others like you are the reason all of this works! So thank you & happy coding! š
Renaming and Updates to the Authentication Test File
The pkg/authentication/example_test.go
file underwent several modifications, including the renaming of the "github.com/microsoft/kiota-http-go"
import package to "kiotaHttp"
. Additionally, the function ExampleApiClient_Octocat
was also updated with fresh code. Moreover, two new functions, Example_ResponseHandlerForRateLimiting
and Example_HttpClientForRateLimiting
, have been integrated into the system to handle functionalities lying under rate limiting.
Addition of New Transport File
A fresh file titled pkg/transport/transport.go
has been integrated into the system. This file contains new code related to rate limiting in HTTP requests, showing our efforts to maintain consistent service regardless of traffic patterns or spikes.
Note that parts of testing code were taken from our colleagues at Kiota (as noted here) and parts of implementation code were taken from the google/go-github library (as noted here). I'm grateful to those teams for doing excellent work before us!
This PR adds a rate limit handler to the go-sdk for primary and secondary rate limits. When it detects such a rate limit, it sleeps until the limit has expired, then retries the request. This has been validated using a local GitHub test environment in addition to unit test coverage. In the future, it would be cool to build better retry logic that builds in exponential backoff, jitter, throttling, etc.
It also greatly simplifies the abstractions for API client instantiation. The values I focused on were:
The current pattern looks like this: