This repository was archived by the owner on Aug 23, 2023. It is now read-only.
File tree 2 files changed +13
-11
lines changed
2 files changed +13
-11
lines changed Original file line number Diff line number Diff line change @@ -183,13 +183,10 @@ func (c *CCache) evict(target *accnt.EvictTarget) {
183
183
if length == 0 {
184
184
delete (c .metricCache , target .Metric )
185
185
186
- if ccms , ok := c .metricRawKeys [ccm .RawMetric ]; ok {
187
- if _ , ok := ccms [ccm .Cons ]; ok {
188
- delete (ccms , ccm .Cons )
189
- if len (ccms ) == 0 {
190
- delete (c .metricRawKeys , ccm .RawMetric )
191
- }
192
- }
186
+ // this key should alway be present, if not there there is a corruption of the state
187
+ delete (c .metricRawKeys [ccm .RawMetric ], ccm .Cons )
188
+ if len (c .metricRawKeys [ccm .RawMetric ]) == 0 {
189
+ delete (c .metricRawKeys , ccm .RawMetric )
193
190
}
194
191
}
195
192
}
Original file line number Diff line number Diff line change @@ -48,11 +48,16 @@ func (mc *CCacheMetric) Del(ts uint32) int {
48
48
prev := mc .chunks [ts ].Prev
49
49
next := mc .chunks [ts ].Next
50
50
51
- if _ , ok := mc .chunks [prev ]; prev != 0 && ok {
52
- mc .chunks [prev ].Next = 0
51
+ if prev != 0 {
52
+ if _ , ok := mc .chunks [prev ]; ok {
53
+ mc .chunks [prev ].Next = 0
54
+ }
53
55
}
54
- if _ , ok := mc .chunks [next ]; next != 0 && ok {
55
- mc .chunks [next ].Prev = 0
56
+
57
+ if next != 0 {
58
+ if _ , ok := mc .chunks [next ]; ok {
59
+ mc .chunks [next ].Prev = 0
60
+ }
56
61
}
57
62
58
63
delete (mc .chunks , ts )
You can’t perform that action at this time.
0 commit comments