Skip to content

Commit

Permalink
Merge pull request #296 from projectsveltos/timeout
Browse files Browse the repository at this point in the history
Use context with timeout when checking compatibility checks
  • Loading branch information
gianlucam76 authored Jan 21, 2025
2 parents d55f8e9 + 2b0e4dd commit e903fae
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion controllers/eventreport_collection.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,10 @@ func collectAndProcessEventReportsFromCluster(ctx context.Context, c client.Clie
return err
}

if !sveltos_upgrade.IsSveltosAgentVersionCompatible(ctx, remoteClient, version) {
const ten = 10
ctxWithTimeout, cancel := context.WithTimeout(ctx, ten*time.Second)
defer cancel()
if !sveltos_upgrade.IsSveltosAgentVersionCompatible(ctxWithTimeout, remoteClient, version) {
msg := "compatibility checks failed"
logger.V(logs.LogDebug).Info(msg)
return errors.New(msg)
Expand Down

0 comments on commit e903fae

Please sign in to comment.