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:
parent
f6a7f642f1
commit
28797c631a
5 changed files with 111 additions and 49 deletions
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue