summaryrefslogtreecommitdiffstats
path: root/web/api/formatters/json/json.c
diff options
context:
space:
mode:
Diffstat (limited to 'web/api/formatters/json/json.c')
-rw-r--r--web/api/formatters/json/json.c10
1 files changed, 8 insertions, 2 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;