mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-06 16:32:31 +01:00
fix (concurrency): prevent concurrent map writes
when booting up, we have a lot of Set in the Config alongside a lot of Get, Let's block all the concurrent Set
This commit is contained in:
parent
231e5ba18d
commit
bb9fb89d44
1 changed files with 1 additions and 1 deletions
|
|
@ -461,11 +461,11 @@ func (this *Configuration) Default(value interface{}) *Configuration {
|
|||
}
|
||||
|
||||
func (this *Configuration) Set(value interface{}) *Configuration {
|
||||
this.mu.Lock()
|
||||
if this.currentElement == nil {
|
||||
return this
|
||||
}
|
||||
|
||||
this.mu.Lock()
|
||||
this.cache.Clear()
|
||||
if this.currentElement.Value != value {
|
||||
this.currentElement.Value = value
|
||||
|
|
|
|||
Loading…
Reference in a new issue