diff --git a/ocaml/xapi/session_check.ml b/ocaml/xapi/session_check.ml index 63ac8fe6e9..d30dbb6d4e 100644 --- a/ocaml/xapi/session_check.ml +++ b/ocaml/xapi/session_check.ml @@ -66,7 +66,8 @@ let check ~intra_pool_only ~session_id ~action = Xapi_stdext_date.Date.to_ptime last_active in match - Ptime.add_span last_active_ptime (Ptime.Span.of_int_s 600) + Ptime.add_span last_active_ptime + !Xapi_globs.threshold_last_active with | None -> let err_msg = diff --git a/ocaml/xapi/xapi_globs.ml b/ocaml/xapi/xapi_globs.ml index 37c62e04e9..56fbce47ed 100644 --- a/ocaml/xapi/xapi_globs.ml +++ b/ocaml/xapi/xapi_globs.ml @@ -712,6 +712,10 @@ let host_assumed_dead_interval = ref Mtime.Span.(10 * min) (* If a session has a last_active older than this we delete it *) let inactive_session_timeout = ref 86400. (* 24 hrs in seconds *) +(* If a session was refreshed more recently than threshold_last_active do not refresh it again. *) +let threshold_last_active = ref (Ptime.Span.of_int_s 600) +(* 10 min in seconds *) + let pending_task_timeout = ref 86400. (* 24 hrs in seconds *) let completed_task_timeout = ref 3900. (* 65 mins *) @@ -1631,6 +1635,11 @@ let other_options = , (fun () -> string_of_int !external_authentication_cache_size) , "Specify the maximum capacity of the external authentication cache" ) + ; ( "threshold_last_active" + , Arg.Int (fun t -> threshold_last_active := Ptime.Span.of_int_s t) + , (fun () -> Format.asprintf "%a" Ptime.Span.pp !threshold_last_active) + , "Specify the threshold below which we do not refresh the session" + ) ] (* The options can be set with the variable xapiflags in /etc/sysconfig/xapi.