forked from TrueCloudLab/frostfs-node
[#969] policer: Restrict the number of remembered errors
Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
This commit is contained in:
parent
6010dfdf3d
commit
c3fa902780
1 changed files with 8 additions and 1 deletions
|
@ -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 a new issue