Nathaniel J. Smith
Nathaniel J. Smith
I accidentally nerd-sniped my friend @nelhage with @Tronic's [HTTP benchmarks](https://github.com/Tronic/async-http-benchmark) that he pasted up-thread (and in particular the nasty latency distribution, which was the part that bothered me the most)....
Huh, that's an interesting case! I'm really not sure what the correct behavior here is. What makes it tricky is that: - The parent process holds onto a reference to...
...That might also let us simplify the fd creation code a bit, because `stdin=PIPE` would become equivalent to `a, b = make_pipe(); stdin=b`.
Portability is an interesting point... on Windows this problem doesn't happen at all, and on Linux like you note there's a simple workaround (modulo any exotic environments where `/dev` and...
@mic006 > Following your discussion, `os.set_blocking(p1.stdout.fileno(), True)` between the 2 trio.open_process can be used as a workaround. Right, that's a good workaround for right now, but it's (1) awkward to...
> I guess one hacky but workable option would be to put p1.stdout into a mode where it toggles O_NONBLOCK on-and-off-again every time the parent process tries to use it....
The quick hack for when this comes up is: ```python async with open_weak_nursery() as weak_nursery: async with trio.open_nursery() as strong_nursery: db = Database() await weak_nursery.start(db.connection) strong_nursery.start_soon(important_job, db) strong_nursery.start_soon(another_important_job) weak_nursery.start_soon(progress_monitor) #...
Added the `asyncio feature parity` label because asyncio does have a `reuse_port` option to their [`create_server`](https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.AbstractEventLoop.create_server).
We should also give some advice on good conventions for how to expose the setting-up-a-background-task part in your public API. Maybe, supporting: ```python async with open_YOUR_TYPE(...) as connection: ... ```...
I guess an example use case for the explicit nursery would be a fan-out proxy, where a task reads from one connection and then sends on 1,000 connections.