From c419d01dedd41367040bb5f29433206799d9ce62 Mon Sep 17 00:00:00 2001 From: Rock Howard Date: Tue, 11 Oct 2016 15:25:27 -0500 Subject: [PATCH] added http_timeout as a command line option for runserver (#387) * added http_timeout as a comand line option for runserver * possible improvement for input param management * explicitly set the default http_timeout in add_argument --- channels/management/commands/runserver.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/channels/management/commands/runserver.py b/channels/management/commands/runserver.py index e52b018..e2c0814 100644 --- a/channels/management/commands/runserver.py +++ b/channels/management/commands/runserver.py @@ -24,10 +24,13 @@ class Command(RunserverCommand): help='Tells Django not to run a worker thread; you\'ll need to run one separately.') parser.add_argument('--noasgi', action='store_false', dest='use_asgi', default=True, help='Run the old WSGI-based runserver rather than the ASGI-based one') + parser.add_argument('--http_timeout', action='store', dest='http_timeout', type=int, default=60, + help='Specify the daphane http_timeout interval in seconds (default: 60)') def handle(self, *args, **options): self.verbosity = options.get("verbosity", 1) self.logger = setup_logger('django.channels', self.verbosity) + self.http_timeout = options.get("http_timeout", 60) super(Command, self).handle(*args, **options) def inner_run(self, *args, **options): @@ -80,7 +83,7 @@ class Command(RunserverCommand): port=int(self.port), signal_handlers=not options['use_reloader'], action_logger=self.log_action, - http_timeout=60, # Shorter timeout than normal as it's dev + http_timeout=self.http_timeout, ws_protocols=getattr(settings, 'CHANNELS_WS_PROTOCOLS', None), ).run() self.logger.debug("Daphne exited")