Fix race condition in database package. Simplify db locking

This commit is contained in:
Patrick Pacher 2020-09-21 15:18:54 +02:00
parent 93a0b27ea2
commit 50a10485e1
No known key found for this signature in database
GPG key ID: E8CD2DA160925A6D
3 changed files with 34 additions and 46 deletions

View file

@ -22,10 +22,8 @@ func (s *Subscription) Cancel() error {
return err
}
c.readLock.Lock()
defer c.readLock.Unlock()
c.writeLock.Lock()
defer c.writeLock.Unlock()
c.exclusiveAccess.Lock()
defer c.exclusiveAccess.Unlock()
if s.canceled {
return nil