[Twisted-Python] Asynchronously reading posted data
exarkun at twistedmatrix.com
exarkun at twistedmatrix.com
Thu Sep 5 05:24:50 MDT 2013
On 08:50 am, poalman at gmail.com wrote:
>Hey,
>
>Thanks for your reply! The json data should never be too long so I'm
>not
>worried about the memory usage, I need the whole json object to start
>working anyway realistically - I was more concerned about blocking
>reading
>the data from the network - specifically the request.content.read(), if
>the
>client happens to be sending it very slowly this would block everything
>up
>right? - or would this not be an issue?
>
>Maybe because I have fairly small content bodies I wont have to worry?
Your resource isn't asked to render a response until the request has
been fully received. Request.content is a StringIO (if it is small) or
a temporary file (if it is larger). Reading from the temporary file
blocks for a little bit since disks are slow but unless your system is
seriously loaded you can usually disregard this.
Jean-Paul
More information about the Twisted-Python
mailing list