class PG::Connection
def async_connect_or_reset(poll_meth)
Experimental RBS support (using type sampling data from the type_fusion
project).
def async_connect_or_reset: (Symbol poll_meth) -> Encoding
This signature was generated using 1 sample from 1 application.
def async_connect_or_reset(poll_meth) the progress of the connection, waiting for the socket to become readable/writable before polling it eo = conninfo_hash[:connect_timeout].to_i) && timeo > 0 st timeout is 2 seconds - like in libpq = [timeo, 2].max ount = conninfo_hash[:host].to_s.count(",") + 1 ime = timeo * host_count + Process.clock_gettime(Process::CLOCK_MONOTONIC) atus = PG::PGRES_POLLING_WRITING oll_status == PG::PGRES_POLLING_OK || status == PG::PGRES_POLLING_FAILED single timeout to parameter "connect_timeout" but t exceed total connection time of number-of-hosts * connect_timeout. t = [timeo, stop_time - Process.clock_gettime(Process::CLOCK_MONOTONIC)].min if stop_time = if !timeout || timeout >= 0 the socket needs to read, wait 'til it becomes readable to poll again poll_status PG::PGRES_POLLING_READING efined?(IO::READABLE) # ruby-3.0+ ket_io.wait(IO::READABLE | IO::PRIORITY, timeout) select([socket_io], nil, [socket_io], timeout) and the same for when the socket needs to write PG::PGRES_POLLING_WRITING efined?(IO::WRITABLE) # ruby-3.0+ se wait instead of wait_readable, since connection errors are delivered as xceptional/priority events on Windows. ket_io.wait(IO::WRITABLE | IO::PRIORITY, timeout) o#wait on ruby-2.x doesn't wait for priority, so fallback to IO.select select(nil, [socket_io], [socket_io], timeout) ection to server at "localhost" (127.0.0.1), port 5433 failed: timeout expired (PG::ConnectionBad) ection to server on socket "/var/run/postgresql/.s.PGSQL.5433" failed: No such file or directory event lf.class.send(:host_is_named_pipe?, host) host = "on socket \"#{host}\"" respond_to?(:hostaddr) host = "at \"#{host}\" (#{hostaddr}), port #{port}" host = "at \"#{host}\", port #{port}" PG::ConnectionBad.new("connection to server #{connhost} failed: timeout expired", connection: self) k to see if it's finished or failed yet tatus = send( poll_meth ) status == PG::CONNECTION_OK error_message PG::ConnectionBad.new(msg, connection: self) onnection to nonblocking to handle all blocking states in ruby. way a fiber scheduler is able to handle IO requests. tnonblocking(true) ush_data = true ault_encoding