X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fwrite_riemann.c;h=ac6b8fbf7b2b7a42afe1eecd07895ef1f2d82cef;hb=f91506bb8f91ca3725fd3081deba4e1829186aaa;hp=f836b9dfe900d74f9edac4f4d756d4a791af9c6c;hpb=6b247abce8371e3074b5a3595d728871a4f1394a;p=collectd.git diff --git a/src/write_riemann.c b/src/write_riemann.c index f836b9df..ac6b8fbf 100644 --- a/src/write_riemann.c +++ b/src/write_riemann.c @@ -28,11 +28,9 @@ * Gergely Nagy */ -#include -#include -#include - #include "collectd.h" + + #include "plugin.h" #include "common.h" #include "configfile.h" @@ -40,6 +38,9 @@ #include "utils_complain.h" #include "write_riemann_threshold.h" +#include +#include + #define RIEMANN_HOST "localhost" #define RIEMANN_PORT 5555 #define RIEMANN_TTL_FACTOR 2.0 @@ -461,30 +462,16 @@ static int wrr_batch_flush_nolock(cdtime_t timeout, cdtime_t now; int status = 0; + now = cdtime(); if (timeout > 0) { - now = cdtime(); - if ((host->batch_init + timeout) > now) + if ((host->batch_init + timeout) > now) { return status; + } } wrr_send_nolock(host, host->batch_msg); riemann_message_free(host->batch_msg); - if (host->client_type != RIEMANN_CLIENT_UDP) - { - riemann_message_t *response; - - response = riemann_client_recv_message(host->client); - - if (!response) - { - wrr_disconnect(host); - return errno; - } - - riemann_message_free(response); - } - - host->batch_init = cdtime(); + host->batch_init = now; host->batch_msg = NULL; return status; } @@ -611,7 +598,7 @@ static int wrr_write(const data_set_t *ds, /* {{{ */ } if (host->client_type != RIEMANN_CLIENT_UDP && host->batch_mode) { - wrr_batch_add_value_list(host, ds, vl, statuses); + wrr_batch_add_value_list(host, ds, vl, statuses); } else { msg = wrr_value_list_to_message(host, ds, vl, statuses); if (msg == NULL)