daphne/channels/signals.py
Luke Hodkinson 0d25860cf2 Run workers in threads. (#322)
* Use a mixin for common test-case code. This way we can have both
a regular channels test-case, and a transaction test-case, too.

* Adding a reference to django-cq.

* Adding the ability to launch a number of workers in threads.
This is to try and help reduce memory consumption.

* Adding a signal for process level worker startups.

* Cleaning up the threaded worker code.

* Use Python 2.7 friendly code.

* Making the runworker command show a little more information
about how many threads are running.

* Moving the worker ready signal into a method in order to support
polymorphic behavior.

* Ugh, I'm an idiot. Was launching the wrong run.

* Adding a call to the workers' `ready` in `runserver`.
2016-08-31 21:26:03 -07:00

12 lines
327 B
Python

from django.db import close_old_connections
from django.dispatch import Signal
consumer_started = Signal(providing_args=["environ"])
consumer_finished = Signal()
worker_ready = Signal()
worker_process_ready = Signal()
# Connect connection closer to consumer finished as well
consumer_finished.connect(close_old_connections)