Add Request Timeout on API level

50 views
Skip to first unread message

Pankhuri Agarwal

unread,
Dec 26, 2017, 7:50:35 AM12/26/17
to Django developers (Contributions to Django itself)
I would like to know if there is any django rest native method to add request timeouts at API level.

Any api having request timeout set to x ms should return response {'status_code': 408, 'message': 'Request Timeout'} after x ms if no other response is returned till that time.

Adam Johnson

unread,
Dec 26, 2017, 4:03:42 PM12/26/17
to django-d...@googlegroups.com
There isn't a native request timeout in Django, however you can configure your hosting WSGI server (at least gunicorn and uWSGI) to have a request timeout, and indeed it's recommended. I'm not sure how hard it would be to implement this (reliably, for all cases and platforms) inside Django.

On 26 December 2017 at 10:54, Pankhuri Agarwal <pankhuri...@gmail.com> wrote:
I would like to know if there is any django rest native method to add request timeouts at API level.

Any api having request timeout set to x ms should return response {'status_code': 408, 'message': 'Request Timeout'} after x ms if no other response is returned till that time.

--
You received this message because you are subscribed to the Google Groups "Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-developers+unsubscribe@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/3deae2cf-c2db-45c0-a12c-c5bae84e0c5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Adam
Reply all
Reply to author
Forward
0 new messages