1
0
Fork 0
mirror of https://github.com/anyproto/any-sync.git synced 2025-06-08 05:57:03 +09:00

pass config by reference

This commit is contained in:
Anatolii Smolianinov 2024-09-17 11:41:30 +02:00
parent 24f660e43d
commit 50eea7e847
No known key found for this signature in database
GPG key ID: 5E259D1D468B99F4

View file

@ -9,7 +9,6 @@ import (
"github.com/anyproto/go-chash"
"go.uber.org/zap"
"fmt"
commonaccount "github.com/anyproto/any-sync/accountservice"
"github.com/anyproto/any-sync/app"
"github.com/anyproto/any-sync/app/logger"
@ -68,7 +67,7 @@ type service struct {
// This is important to avoid the situation when locally stored configuration
// has obsolete coordinator nodes so client can't fetch up-to-date connection info
// (i.e. treeNodes)
func mergeCoordinatorAddrs(appConfig Configuration, lastStored Configuration) (mustRewriteLocalConfig bool) {
func mergeCoordinatorAddrs(appConfig *Configuration, lastStored *Configuration) (mustRewriteLocalConfig bool) {
mustRewriteLocalConfig = false
appNodesByPeer := make(map[string]*Node)
@ -128,7 +127,7 @@ func (s *service) Init(a *app.App) (err error) {
err = nil
}
mergeCoordinatorAddrs(s.config, lastStored)
mergeCoordinatorAddrs(&s.config, &lastStored)
var updatePeriodSec = 600
if confUpd, ok := a.MustComponent("config").(ConfigUpdateGetter); ok && confUpd.GetNodeConfUpdateInterval() > 0 {