fixing some race conditions

This commit is contained in:
2021-12-13 04:33:43 -05:00
parent 851cc327e5
commit 6dba963608
3 changed files with 43 additions and 15 deletions

View File

@@ -269,8 +269,11 @@ func (s *Service) Lock(objects ...LockableObject) (err error) {
}
}
// TODO: use channels and goroutines here.
for _, o := range objects {
go o.Locked()
if _, err = o.Locked(); err != nil {
return
}
}
return
@@ -491,8 +494,11 @@ func (s *Service) Unlock(objects ...LockableObject) (err error) {
}
}
// TODO: use channels and goroutines here.
for _, o := range objects {
go o.Locked()
if _, err = o.Locked(); err != nil {
return
}
}
return