Skip to content

Conversation

@scottleibrand
Copy link
Contributor

We've seen intermittent reports in Gitter of what looks like it might be a race condition around incremental pumphistory refreshes during bolus wizard events, which can cause the carb portion of the bolus wizard record to be recorded but not the insulin portion. This presents a safety issue, so to mitigate it this PR performs a full pumphistory refresh at the end of any loop where a bolus is delivered or a temp basal is set, and there's time before the next BG comes in and we need to start the next loop. This should dramatically shrink the window in which a bad incremental pumphistory refresh could impact dosing decisions, without negatively impacting loop speed or reliability.

@scottleibrand
Copy link
Contributor Author

Tested this and confirmed it forces a Full history refresh when needed:

Checking pump status (suspended/bolusing): {"status":"normal","bolusing":false,"suspended":false}
Sending ESC ESC ESC ESC to exit any open menus before SMBing and bolusing 0.5 units
Checking pump status (suspended/bolusing): {"status":"normal","bolusing":true,"suspended":false}
Settings less than 15 minutes old. Refreshing pumphistory because: bolused, Pump profile refreshed; Settings refresh
ed; Full history refreshed through 2018-08-14T20:29:40-07:00

@scottleibrand
Copy link
Contributor Author

When it has to retry read_full_pumphistory:

Checking pump status (suspended/bolusing): {"status":"normal","bolusing":false,"suspended":false}
Sending ESC ESC ESC ESC to exit any open menus before SMBing and bolusing 0.2 units
Checking pump status (suspended/bolusing): {"status":"normal","bolusing":true,"suspended":false}
Settings less than 15 minutes old. Refreshing pumphistory because: enacted, bolused, Pump profile refreshed; Settings refreshed; Full history refresh failed.
Retry 1 of read_full_pumphistory
Full history refresh failed.
Listening: .No interfering pump comms detected from other rigs (this is a good thing!)
Continuing oref0-pump-loop at Tue Aug 14 20:52:28 PDT 2018
Retry 2 of read_full_pumphistory
Full history refreshed through 2018-08-14T20:51:57-07:00

@alimhassam
Copy link
Contributor

I'm thinking of working on a more robust fix by addressing the FIXME: comment in the incremental read_pump_history function.
This looks like a good workaround/protection in the meantime.

@scottleibrand scottleibrand merged commit d4e61d0 into misc-stuff Aug 15, 2018
@scottleibrand scottleibrand deleted the full-refresh branch August 15, 2018 15:31
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.

3 participants