Django channels with plain multiprocessing
Project description
Rational
Keep thinks simple and stupid.
Adding a redis service makes thinks more complicated
This is a try to use plain python utilities to provide channels layer functionality without configuration
idea
we leverage multiprocessing for providing a channel layer. As multiprocessing doesn't play always nice with async we use a per layer a Thread to serialize the internal requests. Per default the default mp_context is used for creating the manager for multiprocessing synchronization It may be set manually to "spawn" in case of an non python asgi server with multiple process workers
Usage
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_multiprocessing.MultiprocessingChannelLayer"
}
}
with explicit context
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_multiprocessing.MultiprocessingChannelLayer",
"CONFIG": {
"mp_context": "spawn",
},
}
}
Note: all options of BaseLayer are supported (e.g. capacity)
State
tests passed
TODO
- documentation
- investigate aioprocessing
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file channels_multiprocessing-0.1.2.tar.gz
.
File metadata
- Download URL: channels_multiprocessing-0.1.2.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.9 Linux/6.1.11-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7d8936d111c71af80f4bd87ee45438cb78d8a3364b2f059cffb9e2dd4f728b8 |
|
MD5 | e92e0cc4e5c7d1874abf34bb08eacc84 |
|
BLAKE2b-256 | b3f2be0c59119a64ed47bfe3bc55e2eda973e8b84e731b6bb976851187306b97 |
File details
Details for the file channels_multiprocessing-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: channels_multiprocessing-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.10.9 Linux/6.1.11-arch1-1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 90eac73d8525058bddc01f58652bc4ff58e98dfb0f837046d1c2f64019656208 |
|
MD5 | f8ebf410a7c9cdc62fbe82c0a78e6b71 |
|
BLAKE2b-256 | 4c32bc52fc0418c9d392c9e6c7b836cd1ba6c7fe056a1bc103dcd181e77813c6 |