From bb9fb89d444e9edfcaf6dea89199cc722e1774d3 Mon Sep 17 00:00:00 2001 From: Mickael Kerjean Date: Thu, 1 Sep 2022 23:28:29 +1000 Subject: [PATCH] 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 --- server/common/config.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/common/config.go b/server/common/config.go index a38c0c43..ae29712b 100644 --- a/server/common/config.go +++ b/server/common/config.go @@ -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