enable_timeout_every() and fin_time

Поиск
Список
Период
Сортировка
От Andres Freund
Тема enable_timeout_every() and fin_time
Дата
Msg-id 20230102003618.hnynyexncxanuepg@alap3.anarazel.de
обсуждение исходный текст
Ответы Re: enable_timeout_every() and fin_time
Список pgsql-hackers
Hi,

I was looking using enable_timeout_every() in another place with Lukas
just now, and noticed the fin_time argument.  It seems odd for an
interval firing interface to get an absolute timestamp as an
argument. The only in-tree user of enable_timeout_every() computes
fin_time explicitly using the interval time:

    startup_progress_phase_start_time = GetCurrentTimestamp();
    fin_time = TimestampTzPlusMilliseconds(startup_progress_phase_start_time,
                                           log_startup_progress_interval);
    enable_timeout_every(STARTUP_PROGRESS_TIMEOUT, fin_time,
                         log_startup_progress_interval);

In https://postgr.es/m/CA%2BTgmoYqSF5sCNrgTom9r3Nh%3Dat4WmYFD%3DgsV-omStZ60S0ZUQ%40mail.gmail.com
Robert said:
> Apparently not, but here's a v2 anyway. In this version I made
> enable_timeout_every() a three-argument function, so that the caller
> can specify both the first time at which the timeout routine should be
> called and the interval between them, instead of only the latter. That
> seems to be more convenient for this use case, and is more powerful in
> general.

What is the use case for an absolute start time plus a relative
interval?

ISTM that this will just lead to every caller ending up with a
calculation like the startup.c piece quoted above.

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: Add a test to ldapbindpasswd
Следующее
От: "Imseih (AWS), Sami"
Дата:
Сообщение: Re: Add index scan progress to pg_stat_progress_vacuum