Skip to content
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

Missing temporal events after a disconnect #1

Open
osa1 opened this issue Jul 19, 2022 · 2 comments
Open

Missing temporal events after a disconnect #1

osa1 opened this issue Jul 19, 2022 · 2 comments
Labels
bug Something isn't working

Comments

@osa1
Copy link
Owner

osa1 commented Jul 19, 2022

When phone and watch go out of range, after connecting again, it seems like the next temporal event is not getting fired, and the app also doesn't schedule new temporal events.

As a result, we see "next event time" shown as negative number (i.e. we should've done a request but didn't) and we never update the bg levels again.

The workaround is to switch to a widget and then back to the watch face, which schedules a temporal event again.

We should find out which callbacks are called after a re-connection and schedule a temporal event there.

@osa1 osa1 added the bug Something isn't working label Jul 19, 2022
@osa1
Copy link
Owner Author

osa1 commented Jul 29, 2022

I think this problem only occurs when a temporal event is missed because the watch was disconnected.

If the temporal even is not missed during a disconnect, then it's fired as expected after reconnecting, and the next temporal event is scheduled.

@osa1
Copy link
Owner Author

osa1 commented Jul 29, 2024

With acd1f33 I've added temporal event scheduling to per-minute and per-second updates, so we should always have a temporal event scheduled now.

However it will mess up the schedule for the next bg data (i.e. when we skip the next update to catch up with regular 5-min updates again). We should share and resuse this logic:

if (diffSecs < 15) {
// Give Dexcom some time to upload the next reading before
// requesting again
nextEventTime = now.add(FIVE_MINUTES).add(new Time.Duration(15 - diffSecs));
} else if (diffSecs >= 120) {
// Data more than a minute old. Wait 5-N minutes plus a few
// seconds to catch recent readings again.
nextEventTime = now.add(FIVE_MINUTES).add(new Time.Duration(300 - diffSecs + 15));
} else {
nextEventTime = now.add(FIVE_MINUTES);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant