Skip to content

Extend timeout for log collection #43

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion cmd/nginx-supportpkg.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,13 @@ func Execute() {
}

if collector.AllNamespacesExist() {
failedJobs := 0
for _, job := range jobList {
fmt.Printf("Running job %s...", job.Name)
err = job.Collect(collector)
if err != nil {
fmt.Printf(" Error: %s\n", err)
failedJobs++
} else {
fmt.Print(" OK\n")
}
Expand All @@ -75,7 +77,13 @@ func Execute() {
fmt.Println(fmt.Errorf("error when wrapping up: %s", err))
os.Exit(1)
} else {
fmt.Printf("Supportpkg successfully generated: %s\n", tarFile)
if failedJobs == 0 {
fmt.Printf("Supportpkg successfully generated: %s\n", tarFile)
} else {
fmt.Printf("WARNING: %d failed job(s)\n", failedJobs)
fmt.Printf("Supportpkg generated with warnings: %s\n", tarFile)
}

}
} else {
fmt.Println(" Error: Some namespaces do not exist")
Expand Down
2 changes: 1 addition & 1 deletion pkg/jobs/common_job_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func CommonJobList() []Job {
},
{
Name: "collect-pods-logs",
Timeout: time.Second * 30,
Timeout: time.Second * 120,
Execute: func(dc *data_collector.DataCollector, ctx context.Context, ch chan JobResult) {
jobResult := JobResult{Files: make(map[string][]byte), Error: nil}
for _, namespace := range dc.Namespaces {
Expand Down
2 changes: 1 addition & 1 deletion pkg/jobs/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func (j Job) Collect(dc *data_collector.DataCollector) error {

select {
case <-ctx.Done():
dc.Logger.Printf("\tJob %s has timed out: %s\n", j.Name, ctx.Err())
dc.Logger.Printf("\tJob %s has timed out: %s\n---\n", j.Name, ctx.Err())
return errors.New(fmt.Sprintf("Context cancelled: %v", ctx.Err()))

case jobResults := <-ch:
Expand Down
Loading