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

Clean up location manager after making updates suspend #4818

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dshokouhi
Copy link
Member

@dshokouhi dshokouhi commented Nov 14, 2024

Summary

Noticed that we had a few places to clean up and remove overlapping suspend calls

also added in a flush location call to only be called when we need to restart location services to clear out the queue, its also recommended we call it as we use setMaxWaitTime() so this felt like the most appropriate place to call it.

geofences are also limited to 100 per app so adding in 2 condition checks there. Probably needs a docs update for this one and combined with high accuracy expanded mode will be fun to write 🙃

https://developer.android.com/develop/sensors-and-location/location/geofencing

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#pending based on PR approval and discussion

Any other notes

Tested these changes overnight to ensure it all still works as expected

@jpelgrom
Copy link
Member

By removing launch in a lot of places the code now waits/runs in sequence instead of doing this async. I feel like launch was done on purpose in a couple of places, especially for multiserver setups where we want to send to all and don't want to wait for server A to timeout before trying server B. Was this change intentional on your end?

@dshokouhi
Copy link
Member Author

dshokouhi commented Nov 19, 2024

By removing launch in a lot of places the code now waits/runs in sequence instead of doing this async. I feel like launch was done on purpose in a couple of places, especially for multiserver setups where we want to send to all and don't want to wait for server A to timeout before trying server B. Was this change intentional on your end?

well i did not consider that was trying to remove overlapping coroutines

think the latest commit should address this and leave just the setup pieces and notification commands as just suspend along with ensuring we dont hit the 100 geofence limit

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants