Indexer: Use mutex when saving photos to avoid concurrency issues
This commit is contained in:
parent
c2e5663da0
commit
387452858e
1 changed files with 3 additions and 0 deletions
|
@ -227,6 +227,9 @@ func (m *Photo) Create() error {
|
|||
|
||||
// Save updates an existing photo or inserts a new one.
|
||||
func (m *Photo) Save() error {
|
||||
photoMutex.Lock()
|
||||
defer photoMutex.Unlock()
|
||||
|
||||
if err := UnscopedDb().Save(m).Error; err == nil {
|
||||
// Nothing to do.
|
||||
} else if !strings.Contains(strings.ToLower(err.Error()), "lock") {
|
||||
|
|
Loading…
Reference in a new issue