From cdb68d61f5b92e38f72cab9b957ef0c6c7d5f67c Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Sat, 9 Jul 2011 00:46:56 +0200 Subject: [PATCH] Use timeout_add_seconds which is less accurate but more efficient --- mopidy/utils/network.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mopidy/utils/network.py b/mopidy/utils/network.py index fb4b6f4d..ed9c7161 100644 --- a/mopidy/utils/network.py +++ b/mopidy/utils/network.py @@ -127,8 +127,8 @@ class LineProtocol(ThreadingActor): encoding = 'utf-8' #: How long to wait before disconnecting client due to inactivity in - #: milliseconds. - timeout = 30000 + #: seconds. + timeout = 30 def __init__(self, sock, addr): self.sock = sock @@ -180,7 +180,8 @@ class LineProtocol(ThreadingActor): def enable_timeout(self): """Reactivate timeout mechanism.""" self.disable_timeout() - self.timeout_id = gobject.timeout_add(self.timeout, self._timeout) + self.timeout_id = gobject.timeout_add_seconds(self.timeout, + self._timeout) def parse_lines(self, new_data=None): """Consume new data and yield any lines found."""