mirror of
https://github.com/django/daphne.git
synced 2025-07-11 00:12:18 +03:00
Change --alias to --layer on runworker
This commit is contained in:
parent
1ee7b2861c
commit
df8a9dbbd1
|
@ -10,14 +10,14 @@ class Command(BaseCommand):
|
||||||
|
|
||||||
def add_arguments(self, parser):
|
def add_arguments(self, parser):
|
||||||
super(Command, self).add_arguments(parser)
|
super(Command, self).add_arguments(parser)
|
||||||
parser.add_argument('--alias', action='store', dest='alias', default=DEFAULT_CHANNEL_LAYER,
|
parser.add_argument('--layer', action='store', dest='layer', default=DEFAULT_CHANNEL_LAYER,
|
||||||
help='Channel layer alias to use, if not the default.')
|
help='Channel layer alias to use, if not the default.')
|
||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
# Get the backend to use
|
# Get the backend to use
|
||||||
self.verbosity = options.get("verbosity", 1)
|
self.verbosity = options.get("verbosity", 1)
|
||||||
self.logger = setup_logger('django.channels', self.verbosity)
|
self.logger = setup_logger('django.channels', self.verbosity)
|
||||||
self.channel_layer = channel_layers[options.get("alias", DEFAULT_CHANNEL_LAYER)]
|
self.channel_layer = channel_layers[options.get("layer", DEFAULT_CHANNEL_LAYER)]
|
||||||
# Check that handler isn't inmemory
|
# Check that handler isn't inmemory
|
||||||
if self.channel_layer.local_only():
|
if self.channel_layer.local_only():
|
||||||
raise CommandError(
|
raise CommandError(
|
||||||
|
@ -27,7 +27,7 @@ class Command(BaseCommand):
|
||||||
# Check a handler is registered for http reqs
|
# Check a handler is registered for http reqs
|
||||||
self.channel_layer.registry.check_default()
|
self.channel_layer.registry.check_default()
|
||||||
# Launch a worker
|
# Launch a worker
|
||||||
self.logger.info("Running worker against backend %s", self.channel_layer)
|
self.logger.info("Running worker against channel layer %s", self.channel_layer)
|
||||||
# Optionally provide an output callback
|
# Optionally provide an output callback
|
||||||
callback = None
|
callback = None
|
||||||
if self.verbosity > 1:
|
if self.verbosity > 1:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user