From bd0f5acb817a65984509ff648555fc65140873ba Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Tue, 26 Jan 2016 23:32:33 +0100 Subject: [PATCH] frontend/query: Simplified code a little. --- src/frontend/query.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/frontend/query.c b/src/frontend/query.c index 5e44329..2e28324 100644 --- a/src/frontend/query.c +++ b/src/frontend/query.c @@ -248,7 +248,11 @@ exec_timeseries(sdb_ast_timeseries_t *ts, sdb_strbuf_t *buf, sdb_strbuf_t *errbu } if (status >= 0) { series = sdb_plugin_fetch_timeseries(st.type, st.id, &opts); - if (! series) { + if (series) { + sdb_timeseries_tojson(series, buf); + sdb_timeseries_destroy(series); + } + else { sdb_log(SDB_LOG_ERR, "frontend: Failed to fetch time-series '%s/%s' " "- %s fetcher callback returned no data for '%s'", ts->hostname, ts->metric, st.type, st.id); @@ -256,11 +260,6 @@ exec_timeseries(sdb_ast_timeseries_t *ts, sdb_strbuf_t *buf, sdb_strbuf_t *errbu } } - if (status >= 0) { - sdb_timeseries_tojson(series, buf); - sdb_timeseries_destroy(series); - } - free(fetch.hostname); free(fetch.name); if (st.type) -- 2.30.2