From: | Ranier Vilela <ranier(dot)vf(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org, Tristan Partin <tristan(at)partin(dot)io>, Dominique Devienne <ddevienne(at)gmail(dot)com> |
Subject: | Re: Improve the granularity of PQsocketPoll's timeout parameter? |
Date: | 2024-06-13 11:43:50 |
Message-ID: | CAEudQAo68PDRKOXAOug-gbEvR1quyfz1Z7YJ84r5ovyfb47PQg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Em qua., 12 de jun. de 2024 às 16:45, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> escreveu:
> I wrote:
> > v3 attached uses pg_usec_time_t, and fixes one brown-paper-bag
> > bug the cfbot noticed in v2.
>
> Oh, I just remembered that there's a different bit of
> pqConnectDBComplete that we could simplify now:
>
> if (timeout > 0)
> {
> /*
> * Rounding could cause connection to fail unexpectedly
> quickly;
> * to prevent possibly waiting hardly-at-all, insist on at
> least
> * two seconds.
> */
> if (timeout < 2)
> timeout = 2;
> }
> else /* negative means 0 */
> timeout = 0;
>
> With this infrastructure, there's no longer any need to discriminate
> against timeout == 1 second, so we might as well reduce this to
>
> if (timeout < 0)
> timeout = 0;
>
> as it's done elsewhere.
>
I'm unsure if the documentation matches the code?
" connect_timeout #
<https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-CONNECT-TIMEOUT>
Maximum time to wait while connecting, in seconds (write as a decimal
integer, e.g., 10). Zero, negative, or not specified means wait
indefinitely. The minimum allowed timeout is 2 seconds, therefore a value
of 1 is interpreted as 2. This timeout applies separately to each host name
or IP address. For example, if you specify two hosts and connect_timeout is
5, each host will time out if no connection is made within 5 seconds, so
the total time spent waiting for a connection might be up to 10 seconds.
"
The comments says that timeout = 0, means *Timeout is immediate (no
blocking)*
Does the word "indefinitely" mean infinite?
If yes, connect_timeout = -1, mean infinite?
best regards,
Ranier Vilela
From | Date | Subject | |
---|---|---|---|
Next Message | Justin Pryzby | 2024-06-13 11:56:20 | Re: CI and test improvements |
Previous Message | Nazir Bilal Yavuz | 2024-06-13 11:38:46 | Re: CI and test improvements |