> On 10 Oct 2024, at 02:01, Michael Paquier <mich...@paquier.xyz> wrote:
> 
> On Wed, Oct 09, 2024 at 04:24:27PM +0200, Daniel Gustafsson wrote:
>> Fixed.
> 
> -        double        sleep = 2;
> +        double        sleep = pset.watch_interval;
> 
> This forces the use of seconds as unit.  The interval values I have
> been using a lot myself are between 0.2s and 0.5s because I usually
> want a lot more granularity in my lookups than the 1s interval.  Could 
> it be better to allow values lower than 1s or let this value be a
> string with optional "s" or "ms" units?

I'm not sure I follow, it's true that the unit is seconds but the patch doesn't
change the ability to use fractions of a second that we already support today.

db=# \echo :WATCH_INTERVAL
2
db=# \set WATCH_INTERVAL 0.1
db=# \echo :WATCH_INTERVAL
0.1
db=# select 1;
 ?column?
----------
        1
(1 row)

danielg=# \watch
Thu Oct 10 09:32:05 2024 (every 0.1s)

 ?column?
----------
        1
(1 row)

Thu Oct 10 09:32:05 2024 (every 0.1s)

 ?column?
----------
        1
(1 row)

Or did I misunderstand your email?

We could support passing in an optional unit, and assume the unit to be seconds
if none was used, but it doesn't really fit nicely with the current API we have
so I wonder if the added complexity is worth it?

--
Daniel Gustafsson



Reply via email to