- // render the badge
- buffer_svg(w->response.data, label, n * multiply / divide, units, label_color, value_color, value_is_null, precision);
+ // if the collected value is too old, don't calculate its value
+ if (rrdset_last_entry_t(st) >= (time(NULL) - (st->update_every * st->gap_when_lost_iterations_above)))
+ ret = rrd2value(st, w->response.data, &n, (dimensions) ? buffer_tostring(dimensions) : NULL, points, after,
+ before, group, options, &latest_timestamp, &value_is_null);
+
+ // if the value cannot be calculated, show empty badge
+ if (ret != 200) {
+ value_is_null = 1;
+ n = 0;
+ ret = 200;
+ }
+ else if (refresh > 0)
+ buffer_sprintf(w->response.header, "Refresh: %d\r\n", refresh);
+
+ // render the badge
+ buffer_svg(w->response.data, label, n * multiply / divide, units, label_color, value_color, value_is_null,
+ precision);
+ }