Skip to content

Commit 523a33e

Browse files
committed
[core] Nullify odc Devices list before emitting events
1 parent 87a8a6a commit 523a33e

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

core/integration/odc/handlers.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,9 @@ func handleStart(ctx context.Context, odcClient *RpcClient, arguments map[string
310310
return err
311311
}
312312

313+
// We nullify rep.Devices because the payload is too large to be included in the outgoing event
314+
rep.Devices = nil
315+
313316
if odcErr := rep.Reply.GetError(); odcErr != nil {
314317
err = fmt.Errorf("code %d from ODC: %s", odcErr.GetCode(), odcErr.GetMsg())
315318

@@ -442,6 +445,9 @@ func handleStop(ctx context.Context, odcClient *RpcClient, arguments map[string]
442445
return err
443446
}
444447

448+
// We nullify rep.Devices because the payload is too large to be included in the outgoing event
449+
rep.Devices = nil
450+
445451
if odcErr := rep.Reply.GetError(); odcErr != nil {
446452
err = fmt.Errorf("code %d from ODC: %s", odcErr.GetCode(), odcErr.GetMsg())
447453

@@ -829,6 +835,9 @@ func doReset(ctx context.Context, odcClient *RpcClient, arguments map[string]str
829835
return err
830836
}
831837

838+
// We nullify rep.Devices because the payload is too large to be included in the outgoing event
839+
rep.Devices = nil
840+
832841
if odcErr := rep.Reply.GetError(); odcErr != nil {
833842
err = fmt.Errorf("code %d from ODC: %s", odcErr.GetCode(), odcErr.GetMsg())
834843

@@ -955,6 +964,9 @@ func doTerminate(ctx context.Context, odcClient *RpcClient, arguments map[string
955964
return err
956965
}
957966

967+
// We nullify rep.Devices because the payload is too large to be included in the outgoing event
968+
rep.Devices = nil
969+
958970
if odcErr := rep.Reply.GetError(); odcErr != nil {
959971
err = fmt.Errorf("code %d from ODC: %s", odcErr.GetCode(), odcErr.GetMsg())
960972

@@ -1525,6 +1537,9 @@ func handleConfigure(ctx context.Context, odcClient *RpcClient, arguments map[st
15251537
return err
15261538
}
15271539

1540+
// We nullify configureResponse.Devices because the payload is too large to be included in the outgoing event
1541+
configureResponse.Devices = nil
1542+
15281543
if odcErr := configureResponse.Reply.GetError(); odcErr != nil {
15291544
err = fmt.Errorf("code %d from ODC: %s", odcErr.GetCode(), odcErr.GetMsg())
15301545

0 commit comments

Comments
 (0)