[SOLVED] Outgoing Webhook Timeout Time

Is there a way to modify the timeout wait time for outgoing webhooks or force requests to use ipv4? The routing on one of my requests can sometimes take more than 5 seconds to complete. Sometimes curl has intermittent issues with dns name resolution (perhaps something to do with ipv6 vs ipv4 but my networking knowledge is quite limited in this arena) such that name resolution alone takes 5> seconds to complete. curl requests with the -4 option do not suffer from this problem.

The short answer is no. Mattermost requires that connections be established within 3 seconds, and that responses be returned within 30 seconds. The long answer is that you could fork Mattermost and change these constants to suit your case. You can see the details of our HTTP implementation here.

Ultimately I think my solution here is to just fix the DNS resolution issue as it shouldn’t be taking 5 seconds to resolve hostnames. Thanks for the response!

Hi everybody,

I know this is old and resolved - nevertheless would like to bring it back up. I am currently integrating OpenAIs ChatGPT via Webhook and the respond times vary quite a lot which is obvious because of heavy load but also because of the complexity of the service.
This frequently leads to http request timeouts which I can observe in the logs. I found the constants mentioned above are now within /services/httpservice/client.go but I don’t really want to do a fork for this.
Maybe you could consider making the timeouts configurable or are they in the meantime and I missed it? Or would increasing the timeouts be such a bad practice?

Hi @TeamDigiLLab and welcome to the Mattermost forums!

I don’t think there is a new setting, but I’ll see if I can find out more.
There is a somewhat related flag for link metadata which is being collected by the server in the background after posting a link, maybe a timeout value for outgoing HTTP connections could be added as well?

https://docs.mattermost.com/configure/experimental-configuration-settings.html#link-metadata-timeout

we really need something configurable, I built chatgpt mattermost bot but yes, response time can vary. 30s is a lot of time but given we cannot stream we need to wait for the entire response.