Django middleware class to quickly dispatch any requests that wait too long in a queue before being processed
Project description
Django-Request-Queue-Timeout
This package provides a Django middleware class to quickly dispatch any requests that wait too long in a queue before being processed.
This is useful in environments like Heroku, where traffic spikes can result in requests remaining in the queue well beyond the 30 second limit the Heroku router enforces before giving up on the request. With this middleware in place, applications recover much more quickly by not wasting time processing requests for which clients have already received a server error response.
Requirements
Recent versions of Python and Django. See pyproject.toml for exact versions.
Installation
Install from git
pip install git+<git address>#egg=django-request-queue-timeout
Install from PyPI
pip install django-request-queue-timeout
Add to MIDDLEWARE list in settings file as the first item:
MIDDLEWARE = (
'rqto.middleware.RequestQueueTimeoutMiddleware'
...
)
Configuration
When installed, the middleware checks each incoming request for a X-REQUEST-START header value indicating when the request started (in milliseconds since the unix epoch). If the request has queued too long before being processed a 503 Service Unavailable response is generated.
The timeout is 30 seconds by default, but can be configured to a different value by providing a Django setting:
REQUEST_QUEUE_TIMEOUT_IN_SECONDS = 60 # configure a 60 second request queue timeout
See Also
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_request_queue_timeout-1.0.4.tar.gz.
File metadata
- Download URL: django_request_queue_timeout-1.0.4.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
556863904b199d9420cc3b901cf4d645c3720c8df0aa2f8f024d79e51847a890
|
|
| MD5 |
484214d7bd9f32b29b00b0fbdbd43d0a
|
|
| BLAKE2b-256 |
a3282032957abd379e6d59abbb390aaf28caf767accf935b69b50c492ff7a825
|
Provenance
The following attestation bundles were made for django_request_queue_timeout-1.0.4.tar.gz:
Publisher:
publish-release.yml on salesforce/django-request-queue-timeout
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_request_queue_timeout-1.0.4.tar.gz -
Subject digest:
556863904b199d9420cc3b901cf4d645c3720c8df0aa2f8f024d79e51847a890 - Sigstore transparency entry: 760560325
- Sigstore integration time:
-
Permalink:
salesforce/django-request-queue-timeout@c0c4d4d9b411763c024f93969ed8ae48217927c8 -
Branch / Tag:
refs/tags/v1.0.4 - Owner: https://github.com/salesforce
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-release.yml@c0c4d4d9b411763c024f93969ed8ae48217927c8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_request_queue_timeout-1.0.4-py3-none-any.whl.
File metadata
- Download URL: django_request_queue_timeout-1.0.4-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b094487f31434fa788aaec4636dbda9e7709e9b86f94433095aab6df436bd9c
|
|
| MD5 |
53e7422a1b5d0d1bdaafd9d873ca9965
|
|
| BLAKE2b-256 |
30f149aad2effaf9cc03ba1d9f61fdb3a7bbf8119bced0bb1d78172d773e49be
|
Provenance
The following attestation bundles were made for django_request_queue_timeout-1.0.4-py3-none-any.whl:
Publisher:
publish-release.yml on salesforce/django-request-queue-timeout
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_request_queue_timeout-1.0.4-py3-none-any.whl -
Subject digest:
9b094487f31434fa788aaec4636dbda9e7709e9b86f94433095aab6df436bd9c - Sigstore transparency entry: 760560328
- Sigstore integration time:
-
Permalink:
salesforce/django-request-queue-timeout@c0c4d4d9b411763c024f93969ed8ae48217927c8 -
Branch / Tag:
refs/tags/v1.0.4 - Owner: https://github.com/salesforce
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-release.yml@c0c4d4d9b411763c024f93969ed8ae48217927c8 -
Trigger Event:
release
-
Statement type: