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

Investigate ambient mode delayed HTTP calls #6

Open
rahim opened this issue Mar 4, 2019 · 1 comment
Open

Investigate ambient mode delayed HTTP calls #6

rahim opened this issue Mar 4, 2019 · 1 comment
Assignees

Comments

@rahim
Copy link
Owner

rahim commented Mar 4, 2019

The blood glucose service doesn't do anything to change its behaviour in ambient mode - it runs on a background thread, conservatively adding requests via Volley when it's clear it's worth trying to retrieve new data.

On my Ticwatch E with always on enabled, it's evident that we end up with stale data after periods of ambient mode, after touching the screen causing an ambient mode exit we see updated data after a small pause.

@rahim rahim self-assigned this Mar 24, 2019
@rahim
Copy link
Owner Author

rahim commented Mar 24, 2019

Relevant logs from device:

2019-03-24 01:28:03.422 11080-11103/im.rah.nightwear D/BloodGlucoseService: Latest reading age: 490
2019-03-24 01:28:03.422 11080-11103/im.rah.nightwear D/BloodGlucoseService: nightscoutBaseUrl: https://hugo-ns.herokuapp.com
2019-03-24 01:28:03.422 11080-11103/im.rah.nightwear D/BloodGlucoseService: clearing queue, then requesting
2019-03-24 01:28:35.537 11080-11103/im.rah.nightwear D/BloodGlucoseService: refresh
2019-03-24 01:28:35.538 11080-11103/im.rah.nightwear D/BloodGlucoseService: Latest reading age: 522
2019-03-24 01:28:35.538 11080-11103/im.rah.nightwear D/BloodGlucoseService: nightscoutBaseUrl: https://hugo-ns.herokuapp.com
2019-03-24 01:28:35.538 11080-11103/im.rah.nightwear D/BloodGlucoseService: clearing queue, then requesting
2019-03-24 01:29:00.015 11080-11080/im.rah.nightwear D/BloodGlucoseService: tick received
2019-03-24 01:29:00.068 11080-11080/im.rah.nightwear I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/gralloc.mt2601.so from the current namespace instead.
2019-03-24 01:29:01.338 11080-11103/im.rah.nightwear D/BloodGlucoseService: refresh
2019-03-24 01:29:01.338 11080-11103/im.rah.nightwear D/BloodGlucoseService: Latest reading age: 548
2019-03-24 01:29:01.339 11080-11103/im.rah.nightwear D/BloodGlucoseService: nightscoutBaseUrl: https://hugo-ns.herokuapp.com
2019-03-24 01:29:36.949 11080-11103/im.rah.nightwear D/BloodGlucoseService: refresh
2019-03-24 01:29:36.949 11080-11103/im.rah.nightwear D/BloodGlucoseService: Latest reading age: 583
2019-03-24 01:29:36.949 11080-11103/im.rah.nightwear D/BloodGlucoseService: nightscoutBaseUrl: https://hugo-ns.herokuapp.com
2019-03-24 01:29:36.949 11080-11103/im.rah.nightwear D/BloodGlucoseService: clearing queue, then requesting
2019-03-24 01:30:00.017 11080-11080/im.rah.nightwear D/BloodGlucoseService: tick received
2019-03-24 01:30:00.082 11080-11080/im.rah.nightwear I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/gralloc.mt2601.so from the current namespace instead.
2019-03-24 01:30:10.581 11080-11103/im.rah.nightwear D/BloodGlucoseService: refresh
2019-03-24 01:30:10.581 11080-11103/im.rah.nightwear D/BloodGlucoseService: Latest reading age: 617
2019-03-24 01:30:10.581 11080-11103/im.rah.nightwear D/BloodGlucoseService: nightscoutBaseUrl: https://hugo-ns.herokuapp.com
2019-03-24 01:30:10.582 11080-11103/im.rah.nightwear D/BloodGlucoseService: clearing queue, then requesting

# Exited ambient mode here

2019-03-24 01:30:22.523 11080-11080/im.rah.nightwear D/BloodGlucoseService: tick received
2019-03-24 01:30:22.546 11080-11080/im.rah.nightwear I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/gralloc.mt2601.so from the current namespace instead.
2019-03-24 01:30:23.022 11080-11080/im.rah.nightwear I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/gralloc.mt2601.so from the current namespace instead.
2019-03-24 01:30:23.363 11080-11099/im.rah.nightwear D/Volley: [338] BasicNetwork.logSlowRequests: HTTP response for request=<[X] https://hugo-ns.herokuapp.com/api/v1/entries/current 0x6efdc47f NORMAL 431> [lifetime=137761], [size=60], [rc=200], [retryCount=1]
2019-03-24 01:30:23.523 11080-11080/im.rah.nightwear D/BloodGlucoseService: bg received, parsing...
2019-03-24 01:30:24.023 11080-11080/im.rah.nightwear I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/gralloc.mt2601.so from the current namespace instead.
2019-03-24 01:30:25.015 11080-11080/im.rah.nightwear I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/gralloc.mt2601.so from the current namespace instead.
2019-03-24 01:30:26.012 11080-11080/im.rah.nightwear I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/gralloc.mt2601.so from the current namespace instead.
2019-03-24 01:30:27.013 11080-11080/im.rah.nightwear I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/gralloc.mt2601.so from the current namespace instead.
2019-03-24 01:30:27.383 11080-11080/im.rah.nightwear D/BloodGlucoseService: tick received
2019-03-24 01:30:27.448 11080-11080/im.rah.nightwear I/vndksupport: sphal namespace is not configured for this process. Loading /vendor/lib/hw/gralloc.mt2601.so from the current namespace instead.
2019-03-24 01:30:36.724 11080-11103/im.rah.nightwear D/BloodGlucoseService: refresh
2019-03-24 01:30:36.725 11080-11103/im.rah.nightwear D/BloodGlucoseService: Latest reading age: 343

My reading of this is that our background thread lives and queues requests, but that Volley or the OS is blocking the HTTP calls in ambient mode.

It's odd that volley itself logs the request as slow:

2019-03-24 01:30:23.363 11080-11099/im.rah.nightwear D/Volley: [338] BasicNetwork.logSlowRequests: HTTP response for request=<[X] https://hugo-ns.herokuapp.com/api/v1/entries/current 0x6efdc47f NORMAL 431> [lifetime=137761], [size=60], [rc=200], [retryCount=1]

Presumably lifetime is in milliseconds.

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

No branches or pull requests

1 participant