]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
sleep: use shared constant for freeze timeout
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 2 Feb 2023 12:01:24 +0000 (13:01 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 20 Feb 2023 12:38:32 +0000 (13:38 +0100)
Let's keep all the timeout definitions in one place.

src/basic/constants.h
src/sleep/sleep.c

index 5d68cc63320f95cb757a85d4538cf5b3c158118c..3e935f1bcaad8d57e5e8ee7c65742a6e21d87c37 100644 (file)
@@ -42,6 +42,9 @@
 #define DEFAULT_START_LIMIT_INTERVAL (10*USEC_PER_SEC)
 #define DEFAULT_START_LIMIT_BURST 5
 
+/* Wait for 1.5 seconds at maximum for freeze operation */
+#define FREEZE_TIMEOUT (1500 * USEC_PER_MSEC)
+
 /* The default time after which exit-on-idle services exit. This
  * should be kept lower than the watchdog timeout, because otherwise
  * the watchdog pings will keep the loop busy. */
index 9c51a3367f4403c6a96956139466cdbb93e78df8..9018188cba05052834139562cae96b0e5015c359 100644 (file)
@@ -382,8 +382,7 @@ static int freeze_thaw_user_slice(const char **method) {
         if (r < 0)
                 return log_debug_errno(r, "Failed to open connection to systemd: %m");
 
-        /* Wait for 1.5 seconds at maximum for freeze operation */
-        (void) sd_bus_set_method_call_timeout(bus, 1500 * USEC_PER_MSEC);
+        (void) sd_bus_set_method_call_timeout(bus, FREEZE_TIMEOUT);
 
         r = bus_call_method(bus, bus_systemd_mgr, *method, &error, NULL, "s", SPECIAL_USER_SLICE);
         if (r < 0)