Commits

Michael P. Jung committed 30ebf2f

Add POLL_TIMEOUT to make sure inactive sessions are detected as such

Comments (0)

Files changed (2)

opoge/pusher/http.py

 logger = logging.getLogger(__name__)
 
 
+# Seconds after a client is guaranteed to receive an answer. We
+# simply assume that there are some evil proxy servers and browser
+# configurations that timeout after 60 seconds so we make sure
+# to return a few seconds earlier.
+POLL_TIMEOUT = 55
+
+
 # prepare static files
 base_dir = os.path.dirname(os.path.abspath(__file__))
 template_dir = os.path.join(base_dir, 'templates')
         if session.active:
             raise BadRequest('multiple clients polling the same session')
         messages = [(topic and topic.id, message)
-                for topic, message in session.pull()]
+                for topic, message in session.pull(timeout=POLL_TIMEOUT)]
         response = json.dumps({ 'messages': messages })
         return (response, 'application/json')
 

opoge/pusher/server.py

 from opoge.pusher.config import Config
 
 
-POLL_TIMEOUT = 30
 VACUUM_INTERVAL = 10
 SESSION_TIMEOUT = 10