Skip to content
Snippets Groups Projects
Verified Commit 8d575c14 authored by Volker Schukai's avatar Volker Schukai :alien:
Browse files

fix: dissolve dead lock. #7

parent a8d49f6a
Branches
Tags v1.5.1
No related merge requests found
......@@ -50,9 +50,12 @@ func (s *DBSaver) setStatus(status DBSaverStatus) *DBSaver {
}
// isStatus returns true if the DBSaver has the given status
func (s *DBSaver) isStatus(status DBSaverStatus) bool {
// the lock is not needed here, because it is only used in the Start() method
func (s *DBSaver) isStatus(status DBSaverStatus, lock bool) bool {
if lock {
s.mu.Lock()
defer s.mu.Unlock()
}
return s.status == status
......@@ -67,7 +70,7 @@ func (s *DBSaver) Start() error {
return ErrNoDatabaseConnection
}
if s.isStatus(DBSaverStatusRunning) {
if s.isStatus(DBSaverStatusRunning, false) {
return nil
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment