Update notification less often when disconnected for at least 60 s
Saves battery power. Closes #243.
This commit is contained in:
committed by
Keith Winstein
parent
24d2b6e185
commit
dee09fb8fc
@@ -286,7 +286,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;
|
||||
|
||||
Reference in New Issue
Block a user