summaryrefslogtreecommitdiffstats
path: root/web/api/formatters/json
diff options
context:
space:
mode:
Diffstat (limited to 'web/api/formatters/json')
-rw-r--r--web/api/formatters/json/json.c10
-rw-r--r--web/api/formatters/json/json.h2
2 files changed, 9 insertions, 3 deletions
diff --git a/web/api/formatters/json/json.c b/web/api/formatters/json/json.c
index f28eb5738..bf311e22c 100644
--- a/web/api/formatters/json/json.c
+++ b/web/api/formatters/json/json.c
@@ -5,8 +5,14 @@
#define JSON_DATES_JS 1
#define JSON_DATES_TIMESTAMP 2
-void rrdr2json(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, int datatable, RRDDIM *temp_rd) {
- rrdset_check_rdlock(r->st);
+void rrdr2json(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, int datatable, struct context_param *context_param_list)
+{
+ RRDDIM *temp_rd = context_param_list ? context_param_list->rd : NULL;
+
+ int should_lock = (!context_param_list || !(context_param_list->flags & CONTEXT_FLAGS_ARCHIVE));
+
+ if (should_lock)
+ rrdset_check_rdlock(r->st);
//info("RRD2JSON(): %s: BEGIN", r->st->id);
int row_annotations = 0, dates, dates_with_new = 0;
diff --git a/web/api/formatters/json/json.h b/web/api/formatters/json/json.h
index 6d73a3ffe..5c4e11371 100644
--- a/web/api/formatters/json/json.h
+++ b/web/api/formatters/json/json.h
@@ -5,6 +5,6 @@
#include "../rrd2json.h"
-extern void rrdr2json(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, int datatable, RRDDIM *temp_rd);
+extern void rrdr2json(RRDR *r, BUFFER *wb, RRDR_OPTIONS options, int datatable, struct context_param *context_param_list);
#endif //NETDATA_API_FORMATTER_JSON_H