From d07c83c111d1957003fb8f9b7d3ce796027a2667 Mon Sep 17 00:00:00 2001 From: Pascal Fischer Date: Thu, 24 Apr 2025 20:59:59 +0200 Subject: [PATCH] disable read locks --- management/server/store/sql_store.go | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/management/server/store/sql_store.go b/management/server/store/sql_store.go index cae8733c6..687e667ad 100644 --- a/management/server/store/sql_store.go +++ b/management/server/store/sql_store.go @@ -153,19 +153,21 @@ func (s *SqlStore) AcquireWriteLockByUID(ctx context.Context, uniqueID string) ( // AcquireReadLockByUID acquires an ID lock for writing to a resource and returns a function that releases the lock func (s *SqlStore) AcquireReadLockByUID(ctx context.Context, uniqueID string) (unlock func()) { - log.WithContext(ctx).Tracef("acquiring read lock for ID %s", uniqueID) + // log.WithContext(ctx).Tracef("acquiring read lock for ID %s", uniqueID) + // + // start := time.Now() + // value, _ := s.resourceLocks.LoadOrStore(uniqueID, &sync.RWMutex{}) + // mtx := value.(*sync.RWMutex) + // mtx.RLock() + // + // unlock = func() { + // mtx.RUnlock() + // log.WithContext(ctx).Tracef("released read lock for ID %s in %v", uniqueID, time.Since(start)) + // } - start := time.Now() - value, _ := s.resourceLocks.LoadOrStore(uniqueID, &sync.RWMutex{}) - mtx := value.(*sync.RWMutex) - mtx.RLock() - - unlock = func() { - mtx.RUnlock() - log.WithContext(ctx).Tracef("released read lock for ID %s in %v", uniqueID, time.Since(start)) + return func() { + // noop } - - return unlock } func (s *SqlStore) SaveAccount(ctx context.Context, account *types.Account) error {