diff options
| author | 2022-04-24 11:56:06 +0200 | |
|---|---|---|
| committer | 2022-04-24 11:56:06 +0200 | |
| commit | 8d34d5af3ca45472ef7080514aabed6bdc9e5335 (patch) | |
| tree | 1366140c7c83e15c1999f4152708cf71827bb32f | |
| parent | [documentation] NGINX docs updates (#471) (diff) | |
| download | gotosocial-8d34d5af3ca45472ef7080514aabed6bdc9e5335.tar.xz | |
Revert "[chore] Tidy up federating db locks a tiny bit (#472)" (#479)
This reverts commit 31c1067a548039e7d95f131b3972ecfe1f57f835.
| -rw-r--r-- | internal/federation/federatingdb/lock.go | 12 | 
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/federation/federatingdb/lock.go b/internal/federation/federatingdb/lock.go index 4609cd99e..22f2bb77a 100644 --- a/internal/federation/federatingdb/lock.go +++ b/internal/federation/federatingdb/lock.go @@ -52,7 +52,6 @@ func (f *federatingDB) Lock(c context.Context, id *url.URL) error {  	// Acquire map lock  	f.mutex.Lock() -	defer f.mutex.Unlock()  	// Get mutex, or create new  	mu, ok := f.locks[idStr] @@ -64,7 +63,8 @@ func (f *federatingDB) Lock(c context.Context, id *url.URL) error {  		f.locks[idStr] = mu  	} -	// Lock the mutex +	// Unlock map, acquire mutex lock +	f.mutex.Unlock()  	mu.Lock()  	return nil  } @@ -81,13 +81,13 @@ func (f *federatingDB) Unlock(c context.Context, id *url.URL) error {  	}  	idStr := id.String() -	// Acquire map lock +	// Check map for mutex  	f.mutex.Lock() -	defer f.mutex.Unlock() -  	mu, ok := f.locks[idStr] +	f.mutex.Unlock() +  	if !ok { -		return errors.New("Unlock: missing an id in unlock") +		return errors.New("missing an id in unlock")  	}  	// Unlock the mutex  | 
