JohanDegraeve / xdripswift

xdrip for iOS, written in Swift
GNU General Public License v3.0
344 stars 343 forks source link

xDrip delay in logging to Apple Health appears to interfere with connection to sensor #589

Open g5WS opened 2 weeks ago

g5WS commented 2 weeks ago

I have been experiencing extremely frequent dropouts in data for the last couple of months, but only while using my phone. I have captured a simple case.

The Apple Health log shows data had been flowing in every five minutes as expected, however xDrip experienced a 7-minute delay in reporting to Apple Health, and then things kick off:

Date Source Dated Added to Apple Health Observation
3:53:11 🔵xDrip 3:53:11
3:53:11 🟣Trio 3:53:22
3:58:08 🔵xDrip 3:58:08
3:58:08 🟣Trio 3:58:30
4:03:08 🔵xDrip 4:10:34 Entry logged to Apple Health approximately 7 minutes late.
4:03:08 🔵xDrip 4:10:34 This is a duplicate entry. Entry logged to Apple Health approximately 7 minutes late.
4:03:08 🟣Trio 4:10:45 Entry logged to Apple Health approximately 7 minutes late.
4:08:01 🟣Trio 4:11:12 Only Trio picks up the subsequent reading. Three minute delay in logging to Apple Health.
4:10:34 🔵xDrip 4:10:34 Reading received before 5-minute interval. Same BG value as 4:08:01 reading. No delay in logging to Apple Health. ‼️‼️Connectivity appears to drop at this point. xDrip stops receiving data. (Missed readings alert received 20 minutes later.)
4:10:34 🟣Trio 4:11:12 Same BG value as 4:08:01 reading. 4:10 entry logged to Apple Health with slight delay.
4:10:34 🟣Trio 4:31:07 Same BG value as 4:08:01 reading. Duplicate entry, however, there was a 21-minute delay in logging to Apple Health. This reading and subsequent readings did not appear in Apple Health until xDrip displayed the missed readings warning and I switched into xDrip.
4:10:34 🟣Trio 4:31:07 Same BG value as 4:08:01 reading. Triplicate entry.
4:13:03 🔵xDrip 4:31:03 Reading still delayed, but Apple Health received this entry four seconds earlier than the late Trio entries.
4:13:07 🟣Trio 4:31:07
4:18:01 🔵xDrip 4:31:03
4:18:01 🟣Trio 4:31:28
4:23:01 🔵xDrip 4:31:03
4:23:01 🟣Trio 4:31:28
4:30 🔵xDrip xDrip generates missed readings alert. (Missed readings alert is configured for 20 minutes.)
4:31:03 🔵xDrip 4:31:03 This reading received after I switched back into xDrip. Note 8-minute gap in readings.
4:31:03 🟣Trio 4:31:28
4:33:24 🟣Trio 4:38:27 Reading received before 5-minute interval, with 5-minute reporting delay.
4:33:24 🟣Trio 4:38:27 Duplicate entry also has 5-minute reporting delay.
4:38:08 🔵xDrip 4:38:12 Entry posts to Apple Health before Trio entries from 5 minutes earlier.
4:38:08 🟣Trio 4:38:27
4:43:08 🔵xDrip 4:43:09 Data appears to flow normally again.
4:43:08 🟣Trio 4:43:20
g5WS commented 4 days ago

Quick update: turning off Apple Health logging to Trio and xDrip did not improve the data loss alerts, which were honestly going off nearly 4 times an hour while I was using my phone.

I observed that Apple Health was consuming nearly 4.4gb on my phone. While my phone has nearly 64 gb free, it was starting to take a very, very long time to open Apple Health and see data (sometimes in excess of two minutes). I started deleting data, and turned off Apple Health for iCloud.

Things are now so much better! My phone continues to show 4.4gb allocated to Apple Health despite multiple reboots. The Health app becomes unresponsive just, say, trying to toggle whether or not a category is pinned to the summary screen. When I go to see my raw BG data, it takes 14 seconds to load, even though there are only 20 hours of BG data. (!). It takes 7 seconds to load a category where data has never been logged.

I had turned off Live Activities and the widget as part of my testing. I will now attempt to add them back in, and may restore my phone next sensor change to see if I can't clear those phantom 4.4gb. I will update again when I have more data.

[Edit: 2 minutes after I published this, I received another missed readings alarm. Bah. Possibly related to some sort of internal low power mode? I'm at 19% now, and have wondered about battery influence before, even though I have low power features disabled. The testing continues.]


Also, sidebar - I'm not sure if this is functioning as designed or not, but I would set my missed data alert to be 15 minutes. Either immediately or after a period of time (sorry, it's fuzzy!), xDrip would prompt the snooze interval to be 1 hour. After another period of time, xDrip would prompt the snooze interval to be 1 day. These changing intervals may create unnecessary risk, as the user does not expect the interval to change.