Open reubenmiller opened 1 year ago
Investigating the issue and the root cause is that the body template is evaluated when the job is added to the queue and not when the request is sent. This leads to the timestamps being unpredictable when using with delay and delayBefore flags.
There might be a way to delay the evaluation of the body though this will likely be a more complex change (which will take longer).
Until this is fixed, then c8y util repeat --delay 5s
before the c8y events create
(or creating any body using a template)
c8y util repeat 5 \
| c8y util repeat --delay 5s \
| c8y events create --device 12345 --type "myType" --template "{c8y_Winding:{temperature:{value: 25.0,unit:'°C'}}}" --dry --text testme --dryFormat json \
| c8y util show --select body.time -o csv
2023-09-12T20:25:25.541+10:00
2023-09-12T20:25:30.397+10:00
2023-09-12T20:25:35.397+10:00
2023-09-12T20:25:40.398+10:00
2023-09-12T20:25:45.400+10:00
There is a strange behaviour where the timestamp is not being evaluated too early for the first 3 elements, then afterwards the timestamp works as expected.
This behaviour is reproducible via the following snippet:
The expected outcome is that the
time
property should be offset by ~5 seconds for each entry, where as the following clearly shows that the time is not uniformly distributed: