Skip to content

Conversation

@juehv
Copy link
Contributor

@juehv juehv commented Feb 10, 2019

When monitor/cgm-mm-glucosedirty.json is empy (maybe caused by filesystem damage or sudden power loss), the script will end with a "timeinterval less than 5 minutes" massage. There is no way out of this loop until the file gets deleted. I've added a check for empty file and delete the file if it is empty to force the script to a full refresh.

Testen on my pi0 based rig. The error is easy to produce with "rm monitor/cgm-mm-glucosedirty.json && touch monitor/cgm-mm-glucosedirty.json" on the old scrit. With the new script it works fine.

When monitor/cgm-mm-glucosedirty.json is empy (maybe caused by filesystem damage or sudden power loss), the script will end with a "timeinterval less than 5 minutes" massage. There is no way out of this loop until the file gets deleted. I've added a check for empty file and delete the file if it is empty to force the script to a full refresh.

Testen on my pi0 based rig. The error is easy to produce with "rm monitor/cgm-mm-glucosedirty.json && touch monitor/cgm-mm-glucosedirty.json" on the old scrit. With the new script it works fine.
# I don't know what a good schedule is but I thing the Nyquist theorem is good starting point...
jq --exit-status "sort_by(.date) | reverse | .[0] | ($(date +%s) - .date / 1000) < 150" $FILE_MDT > /dev/null
jq --exit-status "sort_by(.date) | reverse | .[0] | ($(date +%s) - .date / 1000) < 300" $FILE_MDT > /dev/null
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change related?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, my assumption from back then doesn't make sense at all. In practice on pi0 nothing changes by this change but on faster pis it will just sync when the bg is older than 5 minutes (instead of 2.5 minutes). To answer you question: no it's not related to the bug but it should be merged as well .. I changed it some time ago and pushed my most recent version.

@scottleibrand scottleibrand merged commit 4a54f2a into openaps:dev Feb 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants