Skip to content

Commit 43a4a13

Browse files
committed
fix bugbot errors
1 parent 65b01b7 commit 43a4a13

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

pkg/analyze/agents/ollama/ollama_agent.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -584,8 +584,8 @@ func (a *OllamaAgent) aggregatePodFiles(bundle *analyzer.SupportBundle, filePath
584584
if !ok {
585585
// Check if this is a single Pod object (has "kind": "Pod")
586586
if kind, exists := podList["kind"].(string); exists && kind == "Pod" {
587-
// Single pod - count as 1
588-
namespaceStats[namespace] = 1
587+
// Single pod - increment count for this namespace
588+
namespaceStats[namespace]++
589589
totalPods++
590590
// Extract status for single pod
591591
if status, ok := podList["status"].(map[string]interface{}); ok {
@@ -602,10 +602,8 @@ func (a *OllamaAgent) aggregatePodFiles(bundle *analyzer.SupportBundle, filePath
602602
}
603603
}
604604
}
605-
} else {
606-
// Not a pod list or single pod, skip
607-
namespaceStats[namespace] = 0
608605
}
606+
// If not a valid pod/podlist, just skip without modifying namespace stats
609607
continue
610608
}
611609

@@ -698,13 +696,11 @@ func (a *OllamaAgent) aggregateDeploymentFiles(bundle *analyzer.SupportBundle, f
698696
if !ok {
699697
// Check if this is a single Deployment object (has "kind": "Deployment")
700698
if kind, exists := deploymentList["kind"].(string); exists && kind == "Deployment" {
701-
// Single deployment - count as 1
702-
namespaceStats[namespace] = 1
699+
// Single deployment - increment count for this namespace
700+
namespaceStats[namespace]++
703701
totalDeployments++
704-
} else {
705-
// Not a deployment list or single deployment, skip
706-
namespaceStats[namespace] = 0
707702
}
703+
// If not a valid deployment/deploymentlist, just skip without modifying namespace stats
708704
continue
709705
}
710706

@@ -759,12 +755,16 @@ func (a *OllamaAgent) aggregateEventFiles(bundle *analyzer.SupportBundle, filePa
759755
// Only include if we haven't reached the limit and the data is reasonable size
760756
if itemCount > 0 && eventsIncluded < 50 {
761757
dataStr := string(data)
762-
// Only include if data size is reasonable and won't exceed 50 event limit
763-
if len(dataStr) < 2000 && (eventsIncluded+itemCount) <= 50 {
758+
// Include file if data size is reasonable, even if it partially exceeds limit
759+
if len(dataStr) < 2000 {
764760
summary.WriteString(fmt.Sprintf("\n--- Events from %s ---\n", filePath))
765761
summary.WriteString(dataStr)
766762
summary.WriteString("\n")
767763
eventsIncluded += itemCount
764+
// Stop including more files once we've included enough events
765+
if eventsIncluded >= 50 {
766+
break
767+
}
768768
}
769769
}
770770
}

0 commit comments

Comments
 (0)