X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=blobdiff_plain;f=src%2Ffrontend%2Fquery.c;h=2e2832469e8d2fed9beb2a405faa513f05edd09c;hp=5e443298b6bd8293a0d5d0eace091e5a4124cec9;hb=bd0f5acb817a65984509ff648555fc65140873ba;hpb=032c425898676e71f2a928cbda48d35d1cdc2900 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)