mirror of
https://github.com/psviderski/uncloud.git
synced 2026-08-28 12:03:33 +00:00
fix: increase wait time for machine to 5 min, discard unknown when decoding json to proto
This commit is contained in:
@@ -149,7 +149,7 @@ func add(ctx context.Context, uncli *cli.CLI, remoteMachine cli.RemoteMachine, o
|
|||||||
func waitClusterInitialised(ctx context.Context, client *client.Client) error {
|
func waitClusterInitialised(ctx context.Context, client *client.Client) error {
|
||||||
boff := backoff.WithContext(backoff.NewExponentialBackOff(
|
boff := backoff.WithContext(backoff.NewExponentialBackOff(
|
||||||
backoff.WithMaxInterval(1*time.Second),
|
backoff.WithMaxInterval(1*time.Second),
|
||||||
backoff.WithMaxElapsedTime(30*time.Second),
|
backoff.WithMaxElapsedTime(5*time.Minute),
|
||||||
), ctx)
|
), ctx)
|
||||||
|
|
||||||
check := func() error {
|
check := func() error {
|
||||||
|
|||||||
@@ -79,10 +79,13 @@ func (s *Store) ListMachines(ctx context.Context) ([]*pb.MachineInfo, error) {
|
|||||||
if err = rows.Scan(&mJSON); err != nil {
|
if err = rows.Scan(&mJSON); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protojsonParser := protojson.UnmarshalOptions{DiscardUnknown: true}
|
||||||
var m pb.MachineInfo
|
var m pb.MachineInfo
|
||||||
if err = protojson.Unmarshal([]byte(mJSON), &m); err != nil {
|
if err = protojsonParser.Unmarshal([]byte(mJSON), &m); err != nil {
|
||||||
return nil, fmt.Errorf("unmarshal machine info: %w", err)
|
return nil, fmt.Errorf("unmarshal machine info: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = m.Network.Validate(); err != nil {
|
if err = m.Network.Validate(); err != nil {
|
||||||
slog.Error("Invalid network configuration for machine in store", "id", m.Id, "err", err)
|
slog.Error("Invalid network configuration for machine in store", "id", m.Id, "err", err)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user