mirror of
https://github.com/caronc/apprise-api.git
synced 2024-11-07 16:54:10 +01:00
APPRISE_API_WORKER_COUNT environment variable added
This commit is contained in:
parent
e3baf815a5
commit
d7824e24c7
@ -202,6 +202,7 @@ The use of environment variables allow you to provide over-rides to default sett
|
||||
| `SECRET_KEY` | A Django variable acting as a *salt* for most things that require security. This API uses it for the hash sequences when writing the configuration files to disk (`hash` mode only).
|
||||
| `ALLOWED_HOSTS` | A list of strings representing the host/domain names that this API can serve. This is a security measure to prevent HTTP Host header attacks, which are possible even under many seemingly-safe web server configurations. By default this is set to `*` allowing any host. Use space to delimit more than one host.
|
||||
| `APPRISE_RECURSION_MAX` | This defines the number of times one Apprise API Server can (recursively) call another. This is to both support and mitigate abuse through [the `apprise://` schema](https://github.com/caronc/apprise/wiki/Notify_apprise_api) for those who choose to use it. When leveraged properly, you can increase this (recursion max) value and successfully load balance the handling of many notification requests through many additional API Servers. By default this value is set to `1` (one).
|
||||
| `APPRISE_WORKER_COUNT` | Defines the number of workers to run. by default this is calculated based on the number of threads detected.
|
||||
| `BASE_URL` | Those who are hosting the API behind a proxy that requires a subpath to gain access to this API should specify this path here as well. By default this is not set at all.
|
||||
| `LOG_LEVEL` | Adjust the log level to the console. Possible values are `CRITICAL`, `ERROR`, `WARNING`, `INFO`, and `DEBUG`.
|
||||
| `DEBUG` | This defaults to `no` and can however be set to `yes` by simply defining the global variable as such.
|
||||
|
@ -22,6 +22,7 @@
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
# THE SOFTWARE.
|
||||
import os
|
||||
import multiprocessing
|
||||
|
||||
# This file is launched with the call:
|
||||
@ -41,7 +42,8 @@ bind = [
|
||||
]
|
||||
|
||||
# Workers are relative to the number of CPU's provided by hosting server
|
||||
workers = multiprocessing.cpu_count() * 2 + 1
|
||||
workers = int(os.environ.get(
|
||||
'APPRISE_WORKER_COUNT', multiprocessing.cpu_count() * 2 + 1))
|
||||
|
||||
# Increase worker timeout value to give upstream services time to
|
||||
# respond
|
||||
|
Loading…
Reference in New Issue
Block a user