-
Notifications
You must be signed in to change notification settings - Fork 45
Fix for pump manager returns bogus podSuspended #141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
add self.tryToValidateComms to handle uncertain comms; ensure podSuspended is only return when actually suspended
Initial TestingSome preliminary testing has been done with the code in this PR using a patch to inject comm errors. In order to use this patch, first download it and then in the Trio or LoopWorkspace folder of a Terminal, issue this command:
ConfigurationTesting was done with both Trio and Loop.
The issue of getting podSuspended is easy to trigger with Trio, so most testing was done with that. Method to fake a comms issue
Testing with fake comms issueWhen testing Trio 0.2.3, this procedure triggers a podSuspended return from the pump manager that is reflected in the Trio log file. When testing Trio 0.2.3 with this PR applied, no bogus podSuspended message is seen. When testing Loop 3.4.4, the behavior with and without this PR appeared to be the same. The Pump Manager should return the correct podState and not rely on upper level code to protect against bogus errors. |
Patches used for TestingI simplified the testing method. The same testing patch is used for Trio and Loop with some versions of OmniBLE. A new testing patch is used when testing Loop 3.4.4 as released. Method to Trigger podSuspended
|
StatusA new commit updated the type of error returned (.communication instead of .state/.deviceState) in a few places. TestsRepeat a small amount of testing Insert fake communication errorsUsing a Trio-dev phone and 10% failure rate for both fakeUncertainBeforeSendPercent and fakeUncertainAfterSendPercent, let the phone run for several hours. In every case, the correct issue/alert showed on the Trio-dev main screen and in every case, the Trio-dev app recovered on its own. Insert issues with the rPi and front endUsing a Trio-dev phone without the special patch for inserting fakeUncertain comms errors.
|
Purpose
This PR fixes a problem reported by Trio users Trio Issue 468 in which the pump manager can sometimes report podSuspended following an uncertain comm event.
Background
An earlier PR #139 added one improvement for automatically recovering from uncertain comms but increased the incidence of the podSuspended being returned from the pump manager when the pod was not actually suspended.
Proposed Solution
This PR adds tryToValidateComms which, if successful, enables the pump manager to return the updated response from getStatus.
It also modifies some guard statements so that a podSuspended is only returned when the last message received from the pod indicates the pod is actually suspended.
The goal is to have the PumpManager return the true pod status, if possible.