Skip to content

Commit

Permalink
update by comments
Browse files Browse the repository at this point in the history
Signed-off-by: guo-shaoge <[email protected]>
  • Loading branch information
guo-shaoge committed Nov 10, 2023
1 parent dfdf2f7 commit c179d78
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions pkg/mcs/resourcemanager/server/token_buckets.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,9 @@ func (gts *GroupTokenBucketState) balanceSlotTokens(
// Only slots that require a positive number will be considered alive,
// but still need to allocate the elapsed tokens as well.
if requiredToken != 0 {
slot = &TokenSlot{}
slot = &TokenSlot{lastReqTime: now}
gts.tokenSlots[clientUniqueID] = slot
gts.clientConsumptionTokensSum = 0
slot.lastReqTime = now
}
} else {
slot.lastReqTime = now
Expand All @@ -153,7 +152,7 @@ func (gts *GroupTokenBucketState) balanceSlotTokens(
for clientUniqueID, slot := range gts.tokenSlots {
if time.Since(slot.lastReqTime) >= slotExpireTimeout {
delete(gts.tokenSlots, clientUniqueID)
log.Info("delete resource group slot because expire", zap.Any("last req time", slot.lastReqTime),
log.Info("delete resource group slot because expire", zap.Time("last-req-time", slot.lastReqTime),
zap.Any("expire timeout", slotExpireTimeout), zap.Any("del client id", clientUniqueID), zap.Any("len", len(gts.tokenSlots)))
}
}
Expand Down

0 comments on commit c179d78

Please sign in to comment.