[ruby-core:87509] timeout in core (was: naruse:r63587 (trunk): Introduce write_timeout to Net::HTTP [Feature #13396])

From: Eric Wong <normalperson@...>
Date: 2018-06-18 23:06:12 UTC
List: ruby-core #87509
Eric Wong <normalperson@yhbt.net> wrote:
> Anyways, the code for handling partial write_nonblock case is verbose.
> One day, I would like to:
> 
> 1) integrate Timeout into core
> 2) make all SOCK_STREAM sockets non-blocking by default
> 3) Make rb_wait_for_single_fd aware of Timeouts

FYI, I'm close to having a patch ready for 1) and 3);
but maybe 3 is optional, even.

> So we can use:
> 
>     Timeout.timeout(@write_timeout) { @io.write(strs) }
> 
> And no new background threads get spawned.

> P.S.: If Ruby were LGPL-2.1+, I would steal the ccan/timer module which
>       is optimized for frequently-expiring timers and be done with 1),
>       already.

ccan/timer may not be the right tool for the job (more on this
later).

Unsubscribe: <mailto:ruby-core-request@ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>

In This Thread

Prev Next