From 10ab880e2835cbc377608d1f2f4f8db1264ae3e6 Mon Sep 17 00:00:00 2001 From: Bart Sopers Date: Fri, 27 Dec 2019 13:51:20 -0500 Subject: [PATCH] Retry Get pulse log command in case of failure --- .../pump/omnipod/driver/ui/OmnipodUITask.java | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java index 797c6c77a0..a8f21d6787 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/pump/omnipod/driver/ui/OmnipodUITask.java @@ -90,13 +90,19 @@ public class OmnipodUITask { break; case GetPodPulseLog: - try { - returnDataObject = communicationManager.readPulseLog(); - } catch(Exception ex) { - if(isLogEnabled()) { - LOG.warn("Failed to retrieve pulse log", ex); + // This command is very error prone, so retry a few times if it fails + // Can take some time, but that's ok since this is a very specific feature for experts + // And will not be used by normal users + for(int i = 0; 3 > i; i++) { + try { + returnDataObject = communicationManager.readPulseLog(); + break; + } catch (Exception ex) { + if (isLogEnabled()) { + LOG.warn("Failed to retrieve pulse log", ex); + } + returnDataObject = null; } - returnDataObject = null; } break;