mattn / go-mastodon

mastodon client for golang
MIT License
603 stars 89 forks source link

Handle HTTP 429 responses with a request backoff approach #85

Closed muesli closed 5 years ago

muesli commented 5 years ago

Since it's difficult to wrap all possible go-mastodon API calls in a backoff algorithm outside of the package itself, I decided to implement a simple version of it in go-mastodon's doAPI itself.

This works nicely, but could be improved in two ways still:

Personally, I still think this is a good start and probably fits most of go-mastodon's use-cases. It certainly beats string-grepping for status code "429" in clients.

coveralls commented 5 years ago

Coverage Status

Coverage decreased (-0.8%) to 90.075% when pulling 4ce6794dc5a1cf1c427fb69e8eeab9199d46264f on muesli:backoff into e804ee7eb264c7bbd58ad9c80291e4d9e2c131a5 on mattn:master.

muesli commented 5 years ago

@mattn Gentle ping :smile: Any feedback you could provide on this PR?

muesli commented 5 years ago

@mattn Ready for another review!

mattn commented 5 years ago

Thank you