django-request-queue-timeout


Namedjango-request-queue-timeout JSON
Version 1.0.3 PyPI version JSON
download
home_page
SummaryDjango middleware class to quickly dispatch any requests that wait too long in a queue before being processed
upload_time2024-02-06 22:17:53
maintainer
docs_urlNone
author
requires_python
licenseMIT License Copyright (c) 2020 Evan Grim Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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.
keywords django queue timeout
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](https://devcenter.heroku.com/articles/http-routing#timeouts) 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

```sh
pip install git+<git address>#egg=django-request-queue-timeout
```
    
Install from [PyPI](https://pypi.org/project/django-request-queue-timeout/)

```sh
pip install django-request-queue-timeout
```

Add to `MIDDLEWARE` list in settings file as the first item:

```python
MIDDLEWARE = (
    'rqto.middleware.RequestQueueTimeoutMiddleware'
    ...
)
```

## Configuration

When installed, the middleware checks each incoming request for a [`X-REQUEST-START` header](https://devcenter.heroku.com/articles/http-routing#heroku-headers) 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:

```python
REQUEST_QUEUE_TIMEOUT_IN_SECONDS = 60  # configure a 60 second request queue timeout
```

## See Also
- [Request Timeout | Heroku Dev Center](https://devcenter.heroku.com/articles/request-timeout)

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "django-request-queue-timeout",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "django,queue,timeout",
    "author": "",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/5f/f1/b3b508478202c35cd0644d40054d49b83af5d1b429fd406104bea0d96195/django-request-queue-timeout-1.0.3.tar.gz",
    "platform": null,
    "description": "# Django-Request-Queue-Timeout\n\nThis package provides a Django middleware class to quickly dispatch any requests that wait too long in a queue before being processed.\n\nThis is useful in environments like Heroku, where traffic spikes can result in requests remaining in the queue well beyond the [30 second limit](https://devcenter.heroku.com/articles/http-routing#timeouts) 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. \n\n## Requirements\n\nRecent versions of Python and Django.  See `pyproject.toml` for exact versions.\n\n## Installation\n\nInstall from git\n\n```sh\npip install git+<git address>#egg=django-request-queue-timeout\n```\n    \nInstall from [PyPI](https://pypi.org/project/django-request-queue-timeout/)\n\n```sh\npip install django-request-queue-timeout\n```\n\nAdd to `MIDDLEWARE` list in settings file as the first item:\n\n```python\nMIDDLEWARE = (\n    'rqto.middleware.RequestQueueTimeoutMiddleware'\n    ...\n)\n```\n\n## Configuration\n\nWhen installed, the middleware checks each incoming request for a [`X-REQUEST-START` header](https://devcenter.heroku.com/articles/http-routing#heroku-headers) 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.\n\nThe timeout is 30 seconds by default, but can be configured to a different value by providing a Django setting:\n\n```python\nREQUEST_QUEUE_TIMEOUT_IN_SECONDS = 60  # configure a 60 second request queue timeout\n```\n\n## See Also\n- [Request Timeout | Heroku Dev Center](https://devcenter.heroku.com/articles/request-timeout)\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2020 Evan Grim  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 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.",
    "summary": "Django middleware class to quickly dispatch any requests that wait too long in a queue before being processed",
    "version": "1.0.3",
    "project_urls": null,
    "split_keywords": [
        "django",
        "queue",
        "timeout"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "bc1ce579a8677e1d19f995cf2cb841df0f1307e27b1fc6698daa4d8ee75a58e5",
                "md5": "685ef463b310f66324d4c59d8e87d4d0",
                "sha256": "5b304e91a14f2c5e8fae1a37f81ec41042b67610b5b235047a2ebb786983523f"
            },
            "downloads": -1,
            "filename": "django_request_queue_timeout-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "685ef463b310f66324d4c59d8e87d4d0",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 4609,
            "upload_time": "2024-02-06T22:17:52",
            "upload_time_iso_8601": "2024-02-06T22:17:52.073676Z",
            "url": "https://files.pythonhosted.org/packages/bc/1c/e579a8677e1d19f995cf2cb841df0f1307e27b1fc6698daa4d8ee75a58e5/django_request_queue_timeout-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5ff1b3b508478202c35cd0644d40054d49b83af5d1b429fd406104bea0d96195",
                "md5": "92b9aa04ecf20487da4d7bec1f6c2382",
                "sha256": "a9284d1c2f08ac4ca24c0329e843b653cd3b874122e80a8f5d40fd173a4e903e"
            },
            "downloads": -1,
            "filename": "django-request-queue-timeout-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "92b9aa04ecf20487da4d7bec1f6c2382",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 3637,
            "upload_time": "2024-02-06T22:17:53",
            "upload_time_iso_8601": "2024-02-06T22:17:53.583170Z",
            "url": "https://files.pythonhosted.org/packages/5f/f1/b3b508478202c35cd0644d40054d49b83af5d1b429fd406104bea0d96195/django-request-queue-timeout-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-06 22:17:53",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "django-request-queue-timeout"
}
        
Elapsed time: 0.17497s