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
with this code, if customDialer.Dial call hangs, you would expect client.DoTimeout to still fail after 500ms, but it would actually occur after 3s due to the default dialer timeout. Note how this function call actually ignores dialTimeout which is respected if no custom dialer was set.
I know we can't control any external dialer implementation if it chooses to ignore timeouts, but I think we should document here that overriding the default dialer causes request timeouts to be ignored.
Furthermore, I think we can consider adding a secondary [DialFunc](https://github.com/valyala/fasthttp/blob/master/client.go#L625) type that accepts timeout to allow custom dialers to respect request timeouts. Note that currently, if I use the built-in dialer with a custom setting (like the example above) I can't set a per-request timeout. Only a global one - meaning when I create a custom dialer I can set it's timeout using the global timeout variable, but if I want to dispatch different requests with different timeouts, the current dialer interface can't support it.
If it matters, i'd be happy to contribute to either the doc change or the implementation change if either is considered.
The text was updated successfully, but these errors were encountered:
If a custom dialer is set when using a fasthttp.Client, request timeout will not be respected if a dial operation hangs.
example code:
with this code, if
customDialer.Dial
call hangs, you would expectclient.DoTimeout
to still fail after 500ms, but it would actually occur after 3s due to the default dialer timeout. Note how this function call actually ignoresdialTimeout
which is respected if no custom dialer was set.I know we can't control any external dialer implementation if it chooses to ignore timeouts, but I think we should document here that overriding the default dialer causes request timeouts to be ignored.
Furthermore, I think we can consider adding a secondary
[DialFunc](https://github.com/valyala/fasthttp/blob/master/client.go#L625)
type that accepts timeout to allow custom dialers to respect request timeouts. Note that currently, if I use the built-in dialer with a custom setting (like the example above) I can't set a per-request timeout. Only a global one - meaning when I create a custom dialer I can set it's timeout using the global timeout variable, but if I want to dispatch different requests with different timeouts, the current dialer interface can't support it.If it matters, i'd be happy to contribute to either the doc change or the implementation change if either is considered.
The text was updated successfully, but these errors were encountered: