Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c - Mailing list pgsql-hackers

From Tom Lane
Subject Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c
Date
Msg-id 20301.1034736099@sss.pgh.pa.us
Whole thread Raw
In response to Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c  (Joe Conway <mail@joeconway.com>)
Responses Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c  (Bruce Momjian <pgman@candle.pha.pa.us>)
List pgsql-hackers
Joe Conway <mail@joeconway.com> writes:
> [ some convincing test cases that timeout=1 is not good ]

>           remains.tv_sec = atoi(conn->connect_timeout);
> +         if (remains.tv_sec == 1)
> +             remains.tv_sec += 1;
>           if (!remains.tv_sec)
>           {
>               conn->status = CONNECTION_BAD;

On pure-paranoia grounds, I'd suggest the logic

+        /* force a sane minimum delay */
+         if (remains.tv_sec < 2)
+             remains.tv_sec = 2;

whereupon you could remove the failure check just below.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Greg Copeland
Date:
Subject: Re: Vacuum improvement
Next
From: Bruce Momjian
Date:
Subject: Re: droped out precise time calculations in src/interfaces/libpq/fe-connect.c