Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
vdarulis committed May 1, 2022
1 parent c9644bd commit cbc4a9e
Showing 1 changed file with 28 additions and 3 deletions.
31 changes: 28 additions & 3 deletions src/aggregator/aggregator/elem_base.go
Original file line number Diff line number Diff line change
Expand Up @@ -754,13 +754,24 @@ func lockedCounterAggregationFromPool(
aggregation counterAggregation,
sourcesSeen map[uint32]*bitset.BitSet,
) *lockedCounterAggregation {
return &lockedCounterAggregation{aggregation: aggregation, sourcesSeen: sourcesSeen}
l := lockedCounterAggregationPool.Get().(*lockedCounterAggregation)
l.aggregation = aggregation
l.sourcesSeen = sourcesSeen
l.lastUpdatedAt = 0
l.dirty = false
l.closed = false
l.resendEnabled = false
return l
}

func (l *lockedCounterAggregation) close() {
l.aggregation.Close()
l.aggregation = counterAggregation{}
l.sourcesSeen = nil
l.lastUpdatedAt = 0
l.dirty = false
l.closed = false
l.resendEnabled = false
lockedCounterAggregationPool.Put(l)
}

Expand All @@ -770,13 +781,20 @@ func lockedGaugeAggregationFromPool(
aggregation gaugeAggregation,
sourcesSeen map[uint32]*bitset.BitSet,
) *lockedGaugeAggregation {
return &lockedGaugeAggregation{aggregation: aggregation, sourcesSeen: sourcesSeen}
l := lockedGaugeAggregationPool.Get().(*lockedGaugeAggregation)
l.aggregation = aggregation
l.sourcesSeen = sourcesSeen
return l
}

func (l *lockedGaugeAggregation) close() {
l.aggregation.Close()
l.aggregation = gaugeAggregation{}
l.sourcesSeen = nil
l.lastUpdatedAt = 0
l.dirty = false
l.closed = false
l.resendEnabled = false
lockedGaugeAggregationPool.Put(l)
}

Expand All @@ -786,12 +804,19 @@ func lockedTimerAggregationFromPool(
aggregation timerAggregation,
sourcesSeen map[uint32]*bitset.BitSet,
) *lockedTimerAggregation {
return &lockedTimerAggregation{aggregation: aggregation, sourcesSeen: sourcesSeen}
l := lockedTimerAggregationPool.Get().(*lockedTimerAggregation)
l.aggregation = aggregation
l.sourcesSeen = sourcesSeen
return l
}

func (l *lockedTimerAggregation) close() {
l.aggregation.Close()
l.aggregation = timerAggregation{}
l.sourcesSeen = nil
l.lastUpdatedAt = 0
l.dirty = false
l.closed = false
l.resendEnabled = false
lockedTimerAggregationPool.Put(l)
}

0 comments on commit cbc4a9e

Please sign in to comment.