Skip to content
This repository has been archived by the owner before Nov 9, 2022. It is now read-only.

thaliMobile's use of setInterval will kill our battery dead #697

Closed
yaronyg opened this issue Apr 1, 2016 · 2 comments
Closed

thaliMobile's use of setInterval will kill our battery dead #697

yaronyg opened this issue Apr 1, 2016 · 2 comments
Assignees
Labels
Milestone

Comments

@yaronyg
Copy link
Member

yaronyg commented Apr 1, 2016

Right now in thaliMobile there is a function called peerAvailabilityWatcher that runs on a regular interval (currently every second) and it checks to see if we have any really old peer availability announcements that need to be cleaned up. But this means that the device cannot ever really go to sleep as it will keep waking up every second! This is an awesome way to obliterate battery.

Thankfully the fix is pretty easy. We just need to calculate when the next entry is supposed to expire and set our timer for that long. Once we have no entries left then we don't set any timer at all. Once we get notified of a new peer event and enter it into peerAvailabilities then we set a new timer.

@yaronyg
Copy link
Member Author

yaronyg commented Aug 11, 2016

The issues are fixed. But tests aren't passing in CI.But it doesn't appear to be our test.

@artemjackson
Copy link
Contributor

artemjackson commented Aug 11, 2016

@yaronyg so could we close this issue?

@yaronyg yaronyg closed this as completed Aug 11, 2016
artemjackson added a commit that referenced this issue Sep 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants