Re: Improve the granularity of PQsocketPoll's timeout parameter?
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Robert Haas <robertmhaas@gmail.com>
Cc: pgsql-hackers@lists.postgresql.org, Tristan Partin <tristan@partin.io>,
Dominique Devienne <ddevienne@gmail.com>
Date: 2024-06-12T19:45:19Z
Lists: pgsql-hackers
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.
regards, tom lane
Commits
-
Improve the granularity of PQsocketPoll's timeout parameter.
- 105024a47238 17.0 landed