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

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