diff --git a/tests/test_app.py b/tests/test_app.py index a88172a..bd31b5f 100644 --- a/tests/test_app.py +++ b/tests/test_app.py @@ -23,7 +23,6 @@ except ImportError: from urllib import urlencode -handler.DELAY = 0.1 swallow_http_errors = handler.swallow_http_errors server_encodings = {e.strip() for e in Server.encodings} @@ -99,6 +98,7 @@ class TestAppBasic(TestAppBase): options.hostfile = '' options.syshostfile = '' options.tdstream = '' + options.delay = 0.1 app = make_app(make_handlers(loop, options), get_app_settings(options)) return app @@ -204,7 +204,7 @@ class TestAppBasic(TestAppBase): url = url.replace('http', 'ws') ws_url = url + 'ws?id=' + data['id'] - yield tornado.gen.sleep(handler.DELAY + 0.1) + yield tornado.gen.sleep(options.delay + 0.1) ws = yield tornado.websocket.websocket_connect(ws_url) msg = yield ws.read_message() self.assertIsNone(msg) diff --git a/webssh/handler.py b/webssh/handler.py index 30ed91e..9b65d1d 100644 --- a/webssh/handler.py +++ b/webssh/handler.py @@ -30,7 +30,6 @@ except ImportError: from urlparse import urlparse -DELAY = 3 DEFAULT_PORT = 22 swallow_http_errors = True @@ -515,8 +514,7 @@ class IndexHandler(MixinHandler, tornado.web.RequestHandler): clients[ip] = workers worker.src_addr = (ip, port) workers[worker.id] = worker - self.loop.call_later(options.delay or DELAY, recycle_worker, - worker) + self.loop.call_later(options.delay, recycle_worker, worker) self.result.update(id=worker.id, encoding=worker.encoding) self.write(self.result) diff --git a/webssh/settings.py b/webssh/settings.py index bf75c2d..5ae4a80 100644 --- a/webssh/settings.py +++ b/webssh/settings.py @@ -44,7 +44,7 @@ separated by comma; '*': wildcard policy, matches any domain, allowed in debug mode only.''') define('wpintvl', type=int, default=0, help='Websocket ping interval') define('timeout', type=int, default=3, help='SSH connection timeout') -define('delay', type=int, default=0, help='The delay to call recycle_worker') +define('delay', type=float, default=3, help='The delay to call recycle_worker') define('maxconn', type=int, default=20, help='Maximum live connections (ssh sessions) per client') define('font', default='', help='custom font filename')