<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Mon, Dec 18, 2017 at 8:37 PM Yury Selivanov <<a href="mailto:yselivanov.ml@gmail.com">yselivanov.ml@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> 3. The connection pool has a queue, and creates a task for each connection to serve requests from that queue. Naively, each task could inherit the context of the request that caused it to be created, but the task would outlive the request and go on to serve other requests. The connection pool would need to specifically suppress the caller's context when creating its worker tasks.<br>
<br>
I haven't used this pattern myself, but it looks like a good case for<br>
adding a keyword-only 'context' rgument to `loop.create_task()`.  This<br>
way the pool can capture the context when some API method is called<br>
and pass it down to the queue along with the request.  The queue task<br>
can then run connection code in that context.<br><br></blockquote><div><br></div><div>Yes, that would be useful.</div><div><br></div><div>-Ben </div></div></div>