File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -229,8 +229,15 @@ func (iMgr *IPSetManager) setsWithReferences() map[string]struct{} {
229229 var setsWithReferences map [string ]struct {}
230230 if haveRefsStill {
231231 setsWithReferences = readByteLinesToMap (setsWithReferencesBytes )
232+ subset := make (map [string ]struct {}, maxLinesToPrint )
233+ for key := range setsWithReferences {
234+ subset [key ] = struct {}{}
235+ if len (subset ) >= maxLinesToPrint {
236+ break
237+ }
238+ }
232239 metrics .SendErrorLogAndMetric (util .IpsmID , "error: found leaked reference counts in kernel. ipsets (max %d): %+v. err: %v" ,
233- maxLinesToPrint , setsWithReferences , err )
240+ maxLinesToPrint , subset , err )
234241 }
235242
236243 return setsWithReferences
@@ -847,9 +854,6 @@ func readByteLinesToMap(output []byte) map[string]struct{} {
847854 line , readIndex = parse .Line (readIndex , output )
848855 hashedSetName := strings .Trim (string (line ), "\n " )
849856 lines [hashedSetName ] = struct {}{}
850- if len (lines ) > maxLinesToPrint {
851- break
852- }
853857 }
854858 return lines
855859}
You can’t perform that action at this time.
0 commit comments