mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 23:58:20 +00:00
Use second granularity for ElasticSearch timeouts.
Since the millisecond resolution cannot be harnessed universally and is not supported by older version of libcurl, we will allow only specifications at the granularity of seconds. This commit also fixes a typing issue that causes that prevented the ElasticSearch timeout to work in the first place: curl_easy_setopt requires a long but was given a uint64_t.
This commit is contained in:
parent
b73809d54f
commit
1ce76da90f
3 changed files with 7 additions and 19 deletions
|
@ -48,7 +48,7 @@ ElasticSearch::ElasticSearch(WriterFrontend* frontend) : WriterBackend(frontend)
|
|||
last_send = current_time();
|
||||
failing = false;
|
||||
|
||||
transfer_timeout = static_cast<uint64>(BifConst::LogElasticSearch::transfer_timeout) * 1000;
|
||||
transfer_timeout = static_cast<long>(BifConst::LogElasticSearch::transfer_timeout);
|
||||
|
||||
curl_handle = HTTPSetup();
|
||||
}
|
||||
|
@ -373,21 +373,8 @@ bool ElasticSearch::HTTPSend(CURL *handle)
|
|||
|
||||
// Some timeout options. These will need more attention later.
|
||||
curl_easy_setopt(handle, CURLOPT_NOSIGNAL, 1);
|
||||
#if LIBCURL_VERSION_NUM > 0x071002
|
||||
curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT_MS, transfer_timeout);
|
||||
curl_easy_setopt(handle, CURLOPT_TIMEOUT_MS, transfer_timeout*2);
|
||||
#else
|
||||
if ( transfer_timeout > 1000 )
|
||||
{
|
||||
curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT, transfer_timeout/1000);
|
||||
curl_easy_setopt(handle, CURLOPT_TIMEOUT, transfer_timeout/2000);
|
||||
}
|
||||
else
|
||||
{
|
||||
curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT, 2);
|
||||
curl_easy_setopt(handle, CURLOPT_TIMEOUT, 1);
|
||||
}
|
||||
#endif
|
||||
curl_easy_setopt(handle, CURLOPT_CONNECTTIMEOUT, transfer_timeout);
|
||||
curl_easy_setopt(handle, CURLOPT_TIMEOUT, transfer_timeout);
|
||||
curl_easy_setopt(handle, CURLOPT_DNS_CACHE_TIMEOUT, 60*60);
|
||||
|
||||
CURLcode return_code = curl_easy_perform(handle);
|
||||
|
|
|
@ -68,7 +68,7 @@ private:
|
|||
|
||||
string path;
|
||||
string index_prefix;
|
||||
uint64 transfer_timeout;
|
||||
long transfer_timeout;
|
||||
bool failing;
|
||||
|
||||
uint64 batch_size;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue