Skip to content

Commit 3379ece

Browse files
committed
Reduce unnecessary last activity time updating
1 parent b69c23b commit 3379ece

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

emailproxy.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -852,10 +852,10 @@ def handle_read(self):
852852

853853
# receiving data from the server while authenticated counts as activity (i.e., ignore pre-login negotiation)
854854
if self.authenticated_username is not None:
855-
activity_time = int(time.time())
855+
activity_time = time.time() // 10 # only update once every 10 or so seconds (timeago shows "just now")
856856
if activity_time > self.last_activity:
857857
config = AppConfig.get()
858-
config.set(self.authenticated_username, 'last_activity', str(activity_time))
858+
config.set(self.authenticated_username, 'last_activity', str(int(time.time())))
859859
self.last_activity = activity_time
860860

861861
# if not authenticated, buffer incoming data and process line-by-line
@@ -1088,7 +1088,7 @@ def handle_accepted(self, connection, address):
10881088
Log.error(error_text)
10891089
if sys.platform == 'darwin':
10901090
Log.error('If you encounter this error repeatedly, please check that you have correctly configured '
1091-
'python root certificates - see: https://github.com/simonrob/email-oauth2-proxy/issues/14')
1091+
'python root certificates; see: https://github.com/simonrob/email-oauth2-proxy/issues/14')
10921092
connection.send(b'%s\r\n' % self.bye_message(error_text).encode('utf-8'))
10931093
connection.close()
10941094

0 commit comments

Comments
 (0)