From fc4561c64c18bf6517e78a3fda2358d48de2f9b8 Mon Sep 17 00:00:00 2001 From: Shireesh Anjal <355479+anjalshireesh@users.noreply.github.com> Date: Fri, 17 May 2024 22:23:34 +0530 Subject: [PATCH] Start callhome immediately after enabling (#19764) Currently, on enabling callhome (or restarting the server), the callhome job gets scheduled. This means that one has to wait for 24hrs (the default frequency duration) to see it in action and to figure out if it is working as expected. It will be a better user experience to perform the first callhome execution immediately after enabling it (or on server start if already enabled). Also, generate audit event on callhome execution, setting the error field in case the execution has failed. --- cmd/callhome.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/callhome.go b/cmd/callhome.go index 074985956..1a172a3ce 100644 --- a/cmd/callhome.go +++ b/cmd/callhome.go @@ -80,6 +80,9 @@ func runCallhome(ctx context.Context, objAPI ObjectLayer) bool { ctx = lkctx.Context() defer locker.Unlock(lkctx) + // Perform callhome once and then keep running it at regular intervals. + performCallhome(ctx) + callhomeTimer := time.NewTimer(globalCallhomeConfig.FrequencyDur()) defer callhomeTimer.Stop() @@ -141,11 +144,14 @@ func performCallhome(ctx context.Context) { select { case hi, hasMore := <-healthInfoCh: if !hasMore { + auditOptions := AuditLogOptions{Event: "callhome:diagnostics"} // Received all data. Send to SUBNET and return err := sendHealthInfo(ctx, healthInfo) if err != nil { internalLogIf(ctx, fmt.Errorf("Unable to perform callhome: %w", err)) + auditOptions.Error = err.Error() } + auditLogInternal(ctx, auditOptions) return } healthInfo = hi