v1-0002-pg_prewarm-fix-autoprewarm_interval-behaviour.patch
text/x-diff
Filename: v1-0002-pg_prewarm-fix-autoprewarm_interval-behaviour.patch
Type: text/x-diff
Part: 1
Patch
Format: format-patch
Series: patch v1-0002
Subject: pg_prewarm: fix autoprewarm_interval behaviour.
| File | + | − |
|---|---|---|
| contrib/pg_prewarm/autoprewarm.c | 1 | 1 |
From 8793b8beb6a5c1ae730f1fffb09dff64c83bc631 Mon Sep 17 00:00:00 2001 From: Alexey Kondratov <kondratov.aleksey@gmail.com> Date: Mon, 9 Nov 2020 19:12:00 +0300 Subject: [PATCH v1 2/3] pg_prewarm: fix autoprewarm_interval behaviour. Previously it misused seconds from TimestampDifference() as milliseconds, so it was dumping autoprewarm.blocks ~every second event with default autoprewarm_interval = 300s. --- contrib/pg_prewarm/autoprewarm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/pg_prewarm/autoprewarm.c b/contrib/pg_prewarm/autoprewarm.c index d3dec6e3ec..b18a065ed5 100644 --- a/contrib/pg_prewarm/autoprewarm.c +++ b/contrib/pg_prewarm/autoprewarm.c @@ -231,7 +231,7 @@ autoprewarm_main(Datum main_arg) autoprewarm_interval * 1000); TimestampDifference(GetCurrentTimestamp(), next_dump_time, &secs, &usecs); - delay_in_ms = secs + (usecs / 1000); + delay_in_ms = secs * 1000 + (usecs / 1000); /* Perform a dump if it's time. */ if (delay_in_ms <= 0) -- 2.19.1