vulcand / oxy

Go middlewares for HTTP servers & proxies
Apache License 2.0
2.02k stars 324 forks source link

Buffer: retry request time interval #191

Open newsdy opened 4 years ago

newsdy commented 4 years ago

Can retry interval be configured? have this function?

dustin-decker commented 4 years ago

I also had this need. Added in #198.

chzhuo commented 4 years ago

Can retry timeout be configured? Retry several times, if the limit timeout is exceeded, break the request。

dustin-decker commented 4 years ago

Yes, you can configure the interval with the option that I added, but otherwise you have the buffer expression to use:

    buffer.Retry(`IsNetworkError() && Attempts() <= 2`),
    buffer.RetrySleep(time.Second))

That would do up to two attempts, sleeping for one second in between. You can set a request timeout with a custom transport provided to the load balancer middleware.