Fix pg_autovacuum -s flag to handle values > 2000 by using sleep()
authorBruce Momjian <[email protected]>
Wed, 11 May 2005 17:58:32 +0000 (17:58 +0000)
committerBruce Momjian <[email protected]>
Wed, 11 May 2005 17:58:32 +0000 (17:58 +0000)
instead of pg_usleep.

Backpatch to 8.0.X.

contrib/pg_autovacuum/pg_autovacuum.c

index 75c4a4969a3613a9a2d648b0df64ee56961e6cf0..e0afb9cfbd8abf94eaaf05c76b01bb9bc2e75f4e 100644 (file)
@@ -1749,7 +1749,16 @@ VacuumLoop(int argc, char **argv)
                        fflush(LOGOUTPUT);
                }
 
-               pg_usleep(sleep_secs * 1000000L);       /* Larger Pause between outer loops */
+               /* Larger Pause between outer loops */
+               /*
+                *      pg_usleep() is wrong here because its maximum is ~2000 seconds,
+                *      and we don't need signal interruptability on Win32 here.
+                */
+#ifndef WIN32
+               sleep(sleep_secs);                      /* Unix sleep is seconds */
+#else
+               sleep(sleep_secs * 1000);       /* Win32 sleep() is milliseconds */
+#endif
 
                gettimeofday(&then, 0); /* Reset time counter */