Browse files

Update notification less often when disconnected for at least 60 s

Saves battery power.  Closes #243.
  • Loading branch information...
1 parent 40a26dd commit 55967e20f3e290069ef48f5420551cad96921bb6 @kmcallister committed May 2, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/frontend/terminaloverlay.cc
View
8 src/frontend/terminaloverlay.cc
@@ -288,7 +288,13 @@ int NotificationEngine::wait_time( void ) const
next_expiry = std::min( next_expiry, message_expiration - now );
if ( need_countup( now ) ) {
- next_expiry = std::min( next_expiry, uint64_t( 1000 ) );
+ uint64_t countup_interval = 1000;
+ if ( ( now - last_word_from_server ) > 60000 ) {
+ /* If we've been disconnected for 60 seconds, save power by updating the
+ display less often. See #243. */
+ countup_interval = Network::ACK_INTERVAL;
+ }
+ next_expiry = std::min( next_expiry, countup_interval );
}
return next_expiry;

0 comments on commit 55967e2

Please sign in to comment.