Re: Improve the granularity of PQsocketPoll's timeout parameter? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Improve the granularity of PQsocketPoll's timeout parameter?
Date
Msg-id 1522504.1718221519@sss.pgh.pa.us
Whole thread Raw
In response to Re: Improve the granularity of PQsocketPoll's timeout parameter?  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Improve the granularity of PQsocketPoll's timeout parameter?
List 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



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Proposal for Updating CRC32C with AVX-512 Algorithm.
Next
From: Noah Misch
Date:
Subject: Re: race condition in pg_class