#33755: Move ASGi body-file cleanup into ASGIRequest
-------------------------------------+-------------------------------------
     Reporter:  Carlton Gibson       |                    Owner:  nobody
         Type:                       |                   Status:  new
  Cleanup/optimization               |
    Component:  HTTP handling        |                  Version:  dev
     Severity:  Normal               |               Resolution:
     Keywords:  ASGI                 |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Description changed by Carlton Gibson:

Old description:

> In `django/core/handlers/asgi.py` `ASGIHandler.handle()` currently
> creates a temporary file, `body_file`, and then maintains responsibility
> for closing that once the response is generated in an extend
> `try...finally`. In outline:
>
> ```
> body_file = ...
>
> try:
>     ...
> finally:
>     body_file.close()
> ```
>
> The `body_file` is passed into the request, via `create_request()` and
> `ASGIRequest.__init()`. Conceptually the request object takes ownership
> of `body_file` at that point, and ideally it would be responsible for
> cleaning it up too, perhaps via a `__del__` implementation.

New description:

 In `django/core/handlers/asgi.py` `ASGIHandler.handle()` currently creates
 a temporary file, `body_file`, and then maintains responsibility for
 closing that once the response is generated in an extend `try...finally`.
 In outline:




 {{{
 body_file = ...

 try:
     ...
 finally:
     body_file.close()
 }}}

 The `body_file` is passed into the request, via `create_request()` and
 `ASGIRequest.__init()`. Conceptually the request object takes ownership of
 `body_file` at that point, and ideally it would be responsible for
 cleaning it up too, perhaps via a `__del__` implementation.

--

-- 
Ticket URL: <https://code.djangoproject.com/ticket/33755#comment:1>
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018118ee6d52-4383aa13-8d9c-4109-8815-6d3265409ada-000000%40eu-central-1.amazonses.com.

Reply via email to