Best coding practice for resiliient client-server communications

131 views
Skip to first unread message

Anssi Porttikivi

unread,
May 25, 2022, 10:02:16 AM5/25/22
to golang-nuts
This was an interesting read:

"Timeouts, retries, and backoff with jitter"
https://aws.amazon.com/builders-library/timeouts-retries-and-backoff-with-jitter/

I wonder what is a good practice in Go code to retry/reconnect/recover but not too aggressively, when connections fail or are stalling or choppy? (Not really AWS specific...) 


Tamás Gulácsi

unread,
May 25, 2022, 10:47:37 AM5/25/22
to golang-nuts
I bet on https://pkg.go.dev/github.com/rogpeppe/retry - it allows a simple

for iter := strategy.Start(); iter.Next(ctx.Done()); {
  if err := todo(ctx); err == nil {
    break
  } else if permanent(err) {
    break

fge...@gmail.com

unread,
May 25, 2022, 1:27:04 PM5/25/22
to golang-nuts
In case you're interested in details of github.com/rogpeppe/retry :
https://www.youtube.com/watch?v=yZTEAXdcuH4
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/golang-nuts/119cbaba-d3b7-4cc0-b1b5-7d86c71bcf7bn%40googlegroups.com.
>
Reply all
Reply to author
Forward
0 new messages