tobyweston / temperature-machine

Data logger for multiple DS18B20 temperature sensors on one or more machines
Apache License 2.0
67 stars 22 forks source link

Move to a staged event driven model to write to the RRD #59

Closed tobyweston closed 6 years ago

tobyweston commented 6 years ago

Currently, temperatures are sent to the server from multiple clients every 30 seconds. Each time they are sent, they are written directly into the RRD. The RRD has an arbitrary constraint whereby it only allows one write every second so it's entirely possible to accidentally break this rule, which results in an error.

Instead, I'd like to move to a staged event model where temperatures are stored in memory and periodically retrieved and stored in the RRD by an independent process.

tobyweston commented 6 years ago

This was going well with like zero RRD 1 second errors until this...


Sat 24-Feb-201804:37:47.985 [temperature-rrd-writing-thread-1] ERROR Error writing bedroom2: RrdError(Bad sample time: 1519486574. Last update time was 1519486632, at least one second step is required)
Sat 24-Feb-201809:45:18.006 [temperature-rrd-writing-thread-1] ERROR Error writing bedroom2: RrdError(Bad sample time: 1519505035. Last update time was 1519505082, at least one second step is required)
Sat 24-Feb-201809:50:48.007 [temperature-rrd-writing-thread-1] ERROR Error writing bedroom1: RrdError(Bad sample time: 1519505411. Last update time was 1519505412, at least one second step is required)
Sat 24-Feb-201809:51:47.975 [temperature-rrd-writing-thread-1] ERROR Error writing bedroom1: RrdError(Bad sample time: 1519505423. Last update time was 1519505472, at least one second step is required)
Sat 24-Feb-201804:37:47.985 [temperature-rrd-writing-thread-1] ERROR Error writing bedroom2: RrdError(Bad sample time: 1519486574. Last update time was 1519486632, at least one second step is required)
Sat 24-Feb-201809:45:18.006 [temperature-rrd-writing-thread-1] ERROR Error writing bedroom2: RrdError(Bad sample time: 1519505035. Last update time was 1519505082, at least one second step is required)
Sat 24-Feb-201809:50:48.007 [temperature-rrd-writing-thread-1] ERROR Error writing bedroom1: RrdError(Bad sample time: 1519505411. Last update time was 1519505412, at least one second step is required)
Sat 24-Feb-201809:51:47.975 [temperature-rrd-writing-thread-1] ERROR Error writing bedroom1: RrdError(Bad sample time: 1519505423. Last update time was 1519505472, at least one second step is required)

Need to check some timings above and muse on...

tobyweston commented 6 years ago

Closing for now