From: Sebastian Harl Date: Tue, 26 Jan 2016 22:32:33 +0000 (+0100) Subject: frontend/query: Simplified code a little. X-Git-Tag: sysdb-0.8.0~5 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bd0f5acb817a65984509ff648555fc65140873ba;p=sysdb.git frontend/query: Simplified code a little. --- 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)