Would this sample code make an even better teaching example if it
used the existing GUC way to declare that worker_spi.naptime is
in units of seconds?

Or does it not do that for some reason I've overlooked?

-Chap
>From 50fd326e5c1ff033c701f90ce09ab9b15d600593 Mon Sep 17 00:00:00 2001
From: Chapman Flack <c...@anastigmatix.net>
Date: Thu, 14 Dec 2017 17:24:46 -0500
Subject: [PATCH] Give worker_spi.naptime an explicit time unit.

---
 src/test/modules/worker_spi/worker_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/test/modules/worker_spi/worker_spi.c b/src/test/modules/worker_spi/worker_spi.c
index 4c6ab6d..d8a7ef5 100644
--- a/src/test/modules/worker_spi/worker_spi.c
+++ b/src/test/modules/worker_spi/worker_spi.c
@@ -316,14 +316,14 @@ _PG_init(void)
 
 	/* get the configuration */
 	DefineCustomIntVariable("worker_spi.naptime",
-							"Duration between each check (in seconds).",
+							"Duration between each check.",
 							NULL,
 							&worker_spi_naptime,
 							10,
 							1,
 							INT_MAX,
 							PGC_SIGHUP,
-							0,
+							GUC_UNIT_S,
 							NULL,
 							NULL,
 							NULL);
-- 
1.8.3.1

Reply via email to