dashbitco / broadway_cloud_pub_sub

A Broadway producer for Google Cloud Pub/Sub
Apache License 2.0
70 stars 24 forks source link

Use Tesla Retry Middleware #58

Closed wronfim closed 3 years ago

wronfim commented 3 years ago

Solving the same problem as: https://github.com/dashbitco/broadway_cloud_pub_sub/pull/56 but this time using Tesla Retry middleware as suggested in the issue discussion: https://github.com/dashbitco/broadway_cloud_pub_sub/issues/55

Decisions I made:

  1. Only retry requests with status code = [408, 500, 502, 503, 504, 522, 524] (suggestions are welcome)
  2. Retry options are 100% configurable.
  3. should_retry/1 is always present if client doesn't pass it to the retry opts
  4. Client can overwrite should_retry/1 function
wronfim commented 3 years ago

This looks really good, I made a couple minor edits below.

The only thing left is to document the :retry option on the GoogleApiClient module, could you take a stab at that?

Yep, I'm updating the docs right now.

Thank you for simplifying the test.

wojtekmach commented 3 years ago

Thanks!