- Notifications
You must be signed in to change notification settings - Fork0
A Django middleware class to quickly dispatch any requests that wait too long in a queue before being processed
License
salesforce/django-request-queue-timeout
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
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 the30 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.
Recent versions of Python and Django. Seepyproject.toml for exact versions.
Install from git
pip install git+<git address>#egg=django-request-queue-timeout
Install fromPyPI
pip install django-request-queue-timeout
Add toMIDDLEWARE list in settings file as the first item:
MIDDLEWARE= ('rqto.middleware.RequestQueueTimeoutMiddleware' ...)
When installed, the middleware checks each incoming request for aX-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 a503 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
About
A Django middleware class to quickly dispatch any requests that wait too long in a queue before being processed
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors4
Uh oh!
There was an error while loading.Please reload this page.