dpward / rpms / sssd

Forked from rpms/sssd 3 years ago
Clone

Blame SOURCES/0017-data_provider_be-Add-random-offset-default.patch

8ad293
From 1e9abd508ea5627465d528788645d4dbe53d7d31 Mon Sep 17 00:00:00 2001
8ad293
From: =?UTF-8?q?Pawe=C5=82=20Po=C5=82awski?= <ppolawsk@redhat.com>
8ad293
Date: Wed, 2 Dec 2020 03:00:26 +0100
8ad293
Subject: [PATCH 17/18] data_provider_be: Add random offset default
8ad293
8ad293
Replace hardcoded default value of 30 with more meaningful
8ad293
OFFLINE_TIMEOUT_RANDOM_OFFSET define.
8ad293
8ad293
This value is used to calculate task timeout during offline
8ad293
status checking by formula (from SSSD MAN page):
8ad293
8ad293
new_interval = (old_interval * 2) + random_offset
8ad293
8ad293
As it is explicite mentioned in documentation it should
8ad293
be expressed in the code similar way.
8ad293
8ad293
Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
8ad293
---
8ad293
 src/providers/data_provider_be.c | 11 ++++++++---
8ad293
 1 file changed, 8 insertions(+), 3 deletions(-)
8ad293
8ad293
diff --git a/src/providers/data_provider_be.c b/src/providers/data_provider_be.c
8ad293
index 4c10d6b48..10421c6b4 100644
8ad293
--- a/src/providers/data_provider_be.c
8ad293
+++ b/src/providers/data_provider_be.c
8ad293
@@ -51,6 +51,7 @@
8ad293
 #define ONLINE_CB_RETRY 3
8ad293
 #define ONLINE_CB_RETRY_MAX_DELAY 4
8ad293
 
8ad293
+#define OFFLINE_TIMEOUT_RANDOM_OFFSET 30
8ad293
 #define OFFLINE_TIMEOUT_DEFAULT 60
8ad293
 #define OFFLINE_TIMEOUT_MAX_DEFAULT 3600
8ad293
 
8ad293
@@ -152,9 +153,13 @@ void be_mark_offline(struct be_ctx *ctx)
8ad293
         offline_timeout = get_offline_timeout(ctx);
8ad293
         offline_timeout_max = get_offline_timeout_max(ctx);
8ad293
 
8ad293
-        ret = be_ptask_create_sync(ctx, ctx,
8ad293
-                                   offline_timeout, offline_timeout,
8ad293
-                                   offline_timeout, 30, offline_timeout,
8ad293
+        ret = be_ptask_create_sync(ctx,
8ad293
+                                   ctx,
8ad293
+                                   offline_timeout,
8ad293
+                                   offline_timeout,
8ad293
+                                   offline_timeout,
8ad293
+                                   OFFLINE_TIMEOUT_RANDOM_OFFSET,
8ad293
+                                   offline_timeout,
8ad293
                                    offline_timeout_max,
8ad293
                                    try_to_go_online,
8ad293
                                    ctx, "Check if online (periodic)",
8ad293
-- 
8ad293
2.21.3
8ad293