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

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

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

Comments

Projects
None yet
2 participants
@yaronyg
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

This comment has been minimized.

Show comment
Hide comment
@yaronyg

yaronyg Aug 11, 2016

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@artemjackson

artemjackson Aug 11, 2016

Contributor

@yaronyg so could we close this issue?

Contributor

artemjackson commented Aug 11, 2016

@yaronyg so could we close this issue?

@yaronyg yaronyg closed this Aug 11, 2016

@yaronyg yaronyg added 4 - Done and removed 3 - Working labels Aug 11, 2016

artemjackson added a commit that referenced this issue Sep 27, 2016

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