#33738: ASGI http.disconnect not handled on requests with body.
--------------------------------+------------------------------------
     Reporter:  Carlton Gibson  |                    Owner:  nobody
         Type:  Bug             |                   Status:  new
    Component:  HTTP handling   |                  Version:  4.0
     Severity:  Normal          |               Resolution:
     Keywords:  ASGI            |             Triage Stage:  Accepted
    Has patch:  0               |      Needs documentation:  0
  Needs tests:  0               |  Patch needs improvement:  0
Easy pickings:  0               |                    UI/UX:  0
--------------------------------+------------------------------------

Comment (by Carlton Gibson):

 Hi Rahul.

 > ... if we perform a loop only while receiving the message and break it
 after X interval of time...

 This won't work I'm afraid. We still need to be able to handle the
 incoming `http.disconnect` at any time.

 It's not 100% straightforward but something **like** Channels'
 `await_many_dispatch()` will be needed. See
 
[https://github.com/django/channels/blob/ae60a7d86f3655a1cc35cd9198e61fe5dcc5d1a1/channels/consumer.py#L56-L62
 the usage here]: it's able to route multiple messages.
 (I don't think the example there is 100% properly handling the disconnect,
 as a kind of interrupt there either, since the dispatch task will only
 process one message at a time, where we're looking to handle a disconnect
 whilst processing a long-running request… 🤔)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33738#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070181a9211192-14b4a726-3dc2-4083-9053-527246239424-000000%40eu-central-1.amazonses.com.

Reply via email to