fix: increase wait time for machine to 5 min, discard unknown when decoding json to proto

This commit is contained in:
Pavel Sviderski
2025-02-26 12:19:04 +10:00
parent 1046396edc
commit 5e9b883ad5
2 changed files with 5 additions and 2 deletions
+4 -1
View File
@@ -79,10 +79,13 @@ func (s *Store) ListMachines(ctx context.Context) ([]*pb.MachineInfo, error) {
if err = rows.Scan(&mJSON); err != nil {
return nil, err
}
protojsonParser := protojson.UnmarshalOptions{DiscardUnknown: true}
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)
}
if err = m.Network.Validate(); err != nil {
slog.Error("Invalid network configuration for machine in store", "id", m.Id, "err", err)
continue