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
Currently in the documentation, a proposed rate limit function is provided as such:
funcrateLimitCallback(lastResponse*helix.Response) error {
iflastResponse.GetRateLimitRemaining() >0 {
returnnil
}
varreset64int64reset64=int64(lastResponse.GetRateLimitReset())
currentTime:=time.Now().Unix()
ifcurrentTime<reset64 {
timeDiff:=time.Duration(reset64-currentTime)
iftimeDiff>0 {
fmt.Printf("Waiting on rate limit to pass before sending next request (%d seconds)\n", timeDiff)
time.Sleep(timeDiff*time.Second)
}
}
returnnil
}
I propose adding this function, sans the print statement, to the core helix library. The user would still have to specify the use of this function, but it would simplify the usage of this library and reduce boiler plate for the end user. As such, a client might instantiate the client like so:
Currently in the documentation, a proposed rate limit function is provided as such:
I propose adding this function, sans the print statement, to the core helix library. The user would still have to specify the use of this function, but it would simplify the usage of this library and reduce boiler plate for the end user. As such, a client might instantiate the client like so:
where
helix.DefaultRateLimit
is the example function above.Thoughts?
The text was updated successfully, but these errors were encountered: