Start only one worker with the nothreading option. (#298)

Reuse the nothreading option of the runserver command to only start one
worker.
This commit is contained in:
Oskar Hahn 2016-08-15 03:18:24 +02:00 committed by Andrew Godwin
parent fb2e9320c2
commit 32568dc879

View File

@ -65,7 +65,8 @@ class Command(RunserverCommand):
# Launch workers as subthreads
if options.get("run_worker", True):
for _ in range(4):
worker_count = 4 if options.get("use_threading", True) else 1
for _ in range(worker_count):
worker = WorkerThread(self.channel_layer, self.logger)
worker.daemon = True
worker.start()