From 65c5031a5e9851e39330420ce541591a0bbf9d39 Mon Sep 17 00:00:00 2001 From: Lars Kanis Date: Thu, 5 Sep 2024 13:53:03 +0200 Subject: [PATCH] Improve code documentation --- spec/helpers/tcp_gate_scheduler.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/helpers/tcp_gate_scheduler.rb b/spec/helpers/tcp_gate_scheduler.rb index 9d48f34dc..aff25996c 100644 --- a/spec/helpers/tcp_gate_scheduler.rb +++ b/spec/helpers/tcp_gate_scheduler.rb @@ -116,7 +116,7 @@ def read( transfer_until: ) # Option `transfer_until` can be (higher to lower priority): # :eof => transfer until channel is closed # :wouldblock => transfer until no immediate data is available - # IO object => transfer until IO is writeable + # IO object => transfer until IO is writable # # The method does nothing if a transfer is already pending, but might raise the transfer_until option, if the requested priority is higher than the pending transfer. def write( transfer_until: ) @@ -282,7 +282,7 @@ def io_wait(io, events, duration) conn.observed_fd = io.fileno if (events & IO::WRITABLE) > 0 - puts "write-trigger #{conn.write_fds} until #{io.fileno} writeable" + puts "write-trigger #{conn.write_fds} until #{io.fileno} writable" conn.write(transfer_until: io) if (events & IO::READABLE) > 0 @@ -292,10 +292,10 @@ def io_wait(io, events, duration) else if (events & IO::READABLE) > 0 puts "write-trigger #{conn.write_fds} until wouldblock" - # Many applications wait for writablility only in a would-block case. - # Then we get no trigger although data was written to the observed IO. - # After writing some data the caller usually waits for some answer to read. - # We take this event as a trigger to transfer of all pending written data. + # libpq waits for writablility only in a would-block case and not before writing. + # Since our incoming IO probably doesn't block, we get no write-trigger although data was written to the observed IO. + # But after writing some data the caller usually waits for some answer to read. + # We take this event as a trigger to transfer all pending written data. conn.write(transfer_until: :wouldblock) puts "read-trigger #{conn.read_fds} single block"