mirror of
https://github.com/django/daphne.git
synced 2025-04-20 08:42:18 +03:00
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
This commit is contained in:
parent
09b2a12be1
commit
c419d01ded
|
@ -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")
|
||||
|
|
Loading…
Reference in New Issue
Block a user