From 1640e7b509797ebc1cfcf45b6d4f3384f5e86cac Mon Sep 17 00:00:00 2001 From: bert hubert Date: Tue, 25 Feb 2020 23:19:09 +0100 Subject: [PATCH] robustify against influxdb out-of-retention stores --- influxpush.cc | 10 ++++++++-- minicurl.cc | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/influxpush.cc b/influxpush.cc index 3d13ad7..e91f180 100644 --- a/influxpush.cc +++ b/influxpush.cc @@ -114,8 +114,14 @@ void InfluxPusher::doSend(const set& buffer) infl.open ("infl.txt", std::ofstream::out | std::ofstream::app); infl << newout; */ - - mc.postURL("http://127.0.0.1:8086/write?db="+d_dbname, newout, mch); + try { + mc.postURL("http://127.0.0.1:8086/write?db="+d_dbname, newout, mch); + } + catch(std::exception& e) { + if(strstr(e.what(), "retention")) + return; + throw; + } } } diff --git a/minicurl.cc b/minicurl.cc index b5a0189..840791a 100644 --- a/minicurl.cc +++ b/minicurl.cc @@ -151,7 +151,7 @@ std::string MiniCurl::postURL(const std::string& str, const std::string& postdat if(res != CURLE_OK || http_code >= 300 ) { cerr<<"Detailed error: "<