Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
Signed-off-by: yangxuan <xuan.yang@zilliz.com>
  • Loading branch information
XuanYang-cn committed Nov 12, 2024
1 parent 6c03f29 commit 12744b4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/util/lock/metric_mutex.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ type MetricsRWMutex struct {

func NewMetricsRWMutex(lockName string) *MetricsRWMutex {
return &MetricsRWMutex{
lockName: lockName,
acquireTimeMap: make(map[string]time.Time, 0),
lockName: lockName,
// acquireTimeMap: make(map[string]time.Time, 0),
acquireTimeMap: typeutil.NewConcurrentMap[string, time.Time](),
}
}
Expand All @@ -43,7 +43,7 @@ func (mRWLock *MetricsRWMutex) RLock(source string) {
if paramtable.Get().CommonCfg.EnableLockMetrics.GetAsBool() {
before := time.Now()
mRWLock.mutex.RLock()
mRWLock.acquireTimeMap.Insert(source) = time.Now()
mRWLock.acquireTimeMap.Insert(source, time.Now())
logLock(time.Since(before), mRWLock.lockName, source, readLock, acquire)
} else {
mRWLock.mutex.RLock()
Expand All @@ -54,7 +54,7 @@ func (mRWLock *MetricsRWMutex) Lock(source string) {
if paramtable.Get().CommonCfg.EnableLockMetrics.GetAsBool() {
before := time.Now()
mRWLock.mutex.Lock()
mRWLock.acquireTimeMap.Insert(source) = time.Now()
mRWLock.acquireTimeMap.Insert(source, time.Now())
logLock(time.Since(before), mRWLock.lockName, source, writeLock, acquire)
} else {
mRWLock.mutex.Lock()
Expand Down

0 comments on commit 12744b4

Please sign in to comment.