forked from TrueCloudLab/frostfs-node
[#969] policer: Restrict the number of remembered errors
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>bugfix/namespace_require
parent
6010dfdf3d
commit
c3fa902780
|
@ -98,6 +98,13 @@ func (m *errMap) addSeenError(cnr cid.ID, err error) bool {
|
|||
return true
|
||||
}
|
||||
}
|
||||
m.skipMap[cnr] = append(m.skipMap[cnr], err)
|
||||
|
||||
// Restrict list length to avoid possible OOM if some random error is added in future.
|
||||
const maxErrListLength = 10
|
||||
|
||||
lst := m.skipMap[cnr]
|
||||
if len(lst) < maxErrListLength {
|
||||
m.skipMap[cnr] = append(lst, err)
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue