Fix concurrent map read/write in rate limiter (#23958)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
congqixia 2023-05-09 11:00:40 +08:00 committed by GitHub
parent 3827ac30bc
commit f6d3b4f7ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,6 +70,9 @@ func (m *MultiRateLimiter) Check(collectionID int64, rt internalpb.RateType, n i
return commonpb.ErrorCode_Success return commonpb.ErrorCode_Success
} }
m.quotaStatesMu.RLock()
defer m.quotaStatesMu.RUnlock()
limiter := m.collectionLimiters[collectionID] limiter := m.collectionLimiters[collectionID]
if limiter == nil { if limiter == nil {
return commonpb.ErrorCode_Success return commonpb.ErrorCode_Success