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

GO-3921: refactored code

Signed-off-by: AnastasiaShemyakinskaya <shem98a@mail.ru>
This commit is contained in:
AnastasiaShemyakinskaya 2024-08-22 16:50:14 +02:00
parent f6a7f642f1
commit 28797c631a
No known key found for this signature in database
GPG key ID: CCD60ED83B103281
5 changed files with 111 additions and 49 deletions

View file

@ -361,7 +361,7 @@ func (c *coordinatorClient) IsNetworkNeedsUpdate(ctx context.Context) (bool, err
if err != nil {
return false, err
}
return version != secureservice.ProtoVersion, nil
return secureservice.ProtoVersion < version, nil
}
func (c *coordinatorClient) doClient(ctx context.Context, f func(cl coordinatorproto.DRPCCoordinatorClient) error) error {

View file

@ -67,17 +67,10 @@ func (n *nodeConfSource) GetLast(ctx context.Context, currentId string) (c nodec
}
}
needsUpdate, err := n.cl.IsNetworkNeedsUpdate(ctx)
if err != nil {
return
}
if needsUpdate {
err = nodeconf.ErrNetworkNeedsUpdate
}
return nodeconf.Configuration{
Id: res.ConfigurationId,
NetworkId: res.NetworkId,
Nodes: nodes,
CreationTime: time.Unix(int64(res.CreationTimeUnix), 0),
}, err
}, nil
}