From: Florian Forster Date: Tue, 9 Oct 2018 07:06:28 +0000 (+0200) Subject: write_stackdriver plugin: Set HTTP request timeout. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=86e623adf66141bfc4b8884f035c1ce62cc8bc42;p=collectd.git write_stackdriver plugin: Set HTTP request timeout. --- diff --git a/src/write_stackdriver.c b/src/write_stackdriver.c index eb60ea9c..7be3c678 100644 --- a/src/write_stackdriver.c +++ b/src/write_stackdriver.c @@ -187,6 +187,12 @@ static int do_post(wg_callback_t *cb, char const *url, void const *payload, curl_easy_setopt(cb->curl, CURLOPT_POST, 1L); curl_easy_setopt(cb->curl, CURLOPT_URL, url); + long timeout_ms = 2 * CDTIME_T_TO_MS(plugin_get_interval()); + if (timeout_ms < 10000) { + timeout_ms = 10000; + } + curl_easy_setopt(cb->curl, CURLOPT_TIMEOUT_MS, timeout_ms); + /* header */ char *auth_header = wg_get_authorization_header(cb); if (auth_header == NULL) {