From f6350ce4757726618801393ec7df7627accd937c Mon Sep 17 00:00:00 2001 From: braydonk Date: Wed, 27 Mar 2024 14:46:00 +0000 Subject: [PATCH] [host] add RefreshBootTimeCache function This commit adds the RefreshBootTimeCache function, allowing users to manually refresh the cached boot time if they are using the `enableBootTimeCache` feature. --- host/host.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/host/host.go b/host/host.go index ee9486369..b6be3a9a0 100644 --- a/host/host.go +++ b/host/host.go @@ -69,6 +69,12 @@ func EnableBootTimeCache(enable bool) { enableBootTimeCache = enable } +// RefreshBootTimeCache manually refreshes the cached BootTime value. +func RefreshBootTimeCache(ctx context.Context) error { + _, err := common.BootTimeWithContext(ctx, false) + return err +} + func Info() (*InfoStat, error) { return InfoWithContext(context.Background()) }