mirror of https://github.com/minio/minio.git
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.
This commit is contained in:
parent
3b7747b42b
commit
fc4561c64c
|
@ -80,6 +80,9 @@ func runCallhome(ctx context.Context, objAPI ObjectLayer) bool {
|
||||||
ctx = lkctx.Context()
|
ctx = lkctx.Context()
|
||||||
defer locker.Unlock(lkctx)
|
defer locker.Unlock(lkctx)
|
||||||
|
|
||||||
|
// Perform callhome once and then keep running it at regular intervals.
|
||||||
|
performCallhome(ctx)
|
||||||
|
|
||||||
callhomeTimer := time.NewTimer(globalCallhomeConfig.FrequencyDur())
|
callhomeTimer := time.NewTimer(globalCallhomeConfig.FrequencyDur())
|
||||||
defer callhomeTimer.Stop()
|
defer callhomeTimer.Stop()
|
||||||
|
|
||||||
|
@ -141,11 +144,14 @@ func performCallhome(ctx context.Context) {
|
||||||
select {
|
select {
|
||||||
case hi, hasMore := <-healthInfoCh:
|
case hi, hasMore := <-healthInfoCh:
|
||||||
if !hasMore {
|
if !hasMore {
|
||||||
|
auditOptions := AuditLogOptions{Event: "callhome:diagnostics"}
|
||||||
// Received all data. Send to SUBNET and return
|
// Received all data. Send to SUBNET and return
|
||||||
err := sendHealthInfo(ctx, healthInfo)
|
err := sendHealthInfo(ctx, healthInfo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
internalLogIf(ctx, fmt.Errorf("Unable to perform callhome: %w", err))
|
internalLogIf(ctx, fmt.Errorf("Unable to perform callhome: %w", err))
|
||||||
|
auditOptions.Error = err.Error()
|
||||||
}
|
}
|
||||||
|
auditLogInternal(ctx, auditOptions)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
healthInfo = hi
|
healthInfo = hi
|
||||||
|
|
Loading…
Reference in New Issue