ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:87425] Re: [ruby-cvs:70678] naruse:r63587 (trunk): Introduce write_timeout to Net::HTTP [Feature #13396]
       [not found] <20180606080347.D09C76B4F3@svn.ruby-lang.org>
@ 2018-06-06  8:58 ` Eric Wong
  2018-06-18 23:06   ` [ruby-core:87509] timeout in core (was: naruse:r63587 (trunk): Introduce write_timeout to Net::HTTP [Feature #13396]) Eric Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Wong @ 2018-06-06  8:58 UTC (permalink / raw
  To: ruby-core; +Cc: naruse

naruse@ruby-lang.org wrote:
>   https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63587

For OpenSSL, I think you need to expect : wait_readable on
write_nonblock, too.


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

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [ruby-core:87509] timeout in core (was: naruse:r63587 (trunk): Introduce write_timeout to Net::HTTP [Feature #13396])
  2018-06-06  8:58 ` [ruby-core:87425] Re: [ruby-cvs:70678] naruse:r63587 (trunk): Introduce write_timeout to Net::HTTP [Feature #13396] Eric Wong
@ 2018-06-18 23:06   ` Eric Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Wong @ 2018-06-18 23:06 UTC (permalink / raw
  To: ruby-core; +Cc: naruse

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).

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-06-18 23:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20180606080347.D09C76B4F3@svn.ruby-lang.org>
2018-06-06  8:58 ` [ruby-core:87425] Re: [ruby-cvs:70678] naruse:r63587 (trunk): Introduce write_timeout to Net::HTTP [Feature #13396] Eric Wong
2018-06-18 23:06   ` [ruby-core:87509] timeout in core (was: naruse:r63587 (trunk): Introduce write_timeout to Net::HTTP [Feature #13396]) Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).