1
0
Fork 0
forked from External/ergo

remove utils.ConfigStore in favor of atomic.Pointer[T]

This commit is contained in:
Shivaram Lingamneni 2022-08-03 00:59:00 -04:00
parent de1be675f5
commit a99c8a42f9
3 changed files with 4 additions and 36 deletions

View file

@ -15,6 +15,7 @@ import (
"strconv"
"strings"
"sync"
"sync/atomic"
"syscall"
"time"
@ -66,7 +67,7 @@ type Server struct {
channels ChannelManager
channelRegistry ChannelRegistry
clients ClientManager
config utils.ConfigStore[Config]
config atomic.Pointer[Config]
configFilename string
connectionLimiter connection_limits.Limiter
ctime time.Time
@ -707,7 +708,7 @@ func (server *Server) applyConfig(config *Config) (err error) {
config.Server.Cloaks.SetSecret(LoadCloakSecret(server.store))
// activate the new config
server.config.Set(config)
server.config.Store(config)
// load [dk]-lines, registered users and channels, etc.
if initial {