Skip to content

Commit e9a7e89

Browse files
committed
[core] Trim down ODC events some more
1 parent 523a33e commit e9a7e89

1 file changed

Lines changed: 22 additions & 5 deletions

File tree

core/integration/odc/handlers.go

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,9 @@ func handleStart(ctx context.Context, odcClient *RpcClient, arguments map[string
180180
return err
181181
}
182182

183+
// We nullify setPropertiesResponse.Hosts because the payload is too large to be included in the outgoing event
184+
setPropertiesResponse.Hosts = nil
185+
183186
if odcErr := setPropertiesResponse.GetError(); odcErr != nil {
184187
log.WithField("partition", envId).
185188
WithError(err).
@@ -310,8 +313,9 @@ func handleStart(ctx context.Context, odcClient *RpcClient, arguments map[string
310313
return err
311314
}
312315

313-
// We nullify rep.Devices because the payload is too large to be included in the outgoing event
316+
// We nullify rep.Devices and rep.Reply.Hosts because the payload is too large to be included in the outgoing event
314317
rep.Devices = nil
318+
rep.Reply.Hosts = nil
315319

316320
if odcErr := rep.Reply.GetError(); odcErr != nil {
317321
err = fmt.Errorf("code %d from ODC: %s", odcErr.GetCode(), odcErr.GetMsg())
@@ -445,8 +449,9 @@ func handleStop(ctx context.Context, odcClient *RpcClient, arguments map[string]
445449
return err
446450
}
447451

448-
// We nullify rep.Devices because the payload is too large to be included in the outgoing event
452+
// We nullify rep.Devices and rep.Reply.Hosts because the payload is too large to be included in the outgoing event
449453
rep.Devices = nil
454+
rep.Reply.Hosts = nil
450455

451456
if odcErr := rep.Reply.GetError(); odcErr != nil {
452457
err = fmt.Errorf("code %d from ODC: %s", odcErr.GetCode(), odcErr.GetMsg())
@@ -835,8 +840,9 @@ func doReset(ctx context.Context, odcClient *RpcClient, arguments map[string]str
835840
return err
836841
}
837842

838-
// We nullify rep.Devices because the payload is too large to be included in the outgoing event
843+
// We nullify rep.Devices and rep.Reply.Hosts because the payload is too large to be included in the outgoing event
839844
rep.Devices = nil
845+
rep.Reply.Hosts = nil
840846

841847
if odcErr := rep.Reply.GetError(); odcErr != nil {
842848
err = fmt.Errorf("code %d from ODC: %s", odcErr.GetCode(), odcErr.GetMsg())
@@ -964,8 +970,9 @@ func doTerminate(ctx context.Context, odcClient *RpcClient, arguments map[string
964970
return err
965971
}
966972

967-
// We nullify rep.Devices because the payload is too large to be included in the outgoing event
973+
// We nullify rep.Devices and rep.Reply.Hosts because the payload is too large to be included in the outgoing event
968974
rep.Devices = nil
975+
rep.Reply.Hosts = nil
969976

970977
if odcErr := rep.Reply.GetError(); odcErr != nil {
971978
err = fmt.Errorf("code %d from ODC: %s", odcErr.GetCode(), odcErr.GetMsg())
@@ -1089,6 +1096,9 @@ func doShutdown(ctx context.Context, odcClient *RpcClient, arguments map[string]
10891096
return err
10901097
}
10911098

1099+
// We nullify rep.Hosts because the payload is too large to be included in the outgoing event
1100+
shutdownResponse.Hosts = nil
1101+
10921102
if odcErr := shutdownResponse.GetError(); odcErr != nil {
10931103
err = fmt.Errorf("code %d from ODC: %s", odcErr.GetCode(), odcErr.GetMsg())
10941104

@@ -1269,6 +1279,9 @@ func handleRun(ctx context.Context, odcClient *RpcClient, isManualXml bool, argu
12691279
return errors.New(errMsg)
12701280
}
12711281

1282+
// We nullify runResponse.Hosts because the payload is too large to be included in the outgoing event
1283+
runResponse.Hosts = nil
1284+
12721285
if odcErr := runResponse.GetError(); odcErr != nil {
12731286
err = fmt.Errorf("code %d from ODC: %s", odcErr.GetCode(), odcErr.GetMsg())
12741287
}
@@ -1406,6 +1419,9 @@ func handleConfigure(ctx context.Context, odcClient *RpcClient, arguments map[st
14061419
return err
14071420
}
14081421

1422+
// We nullify setPropertiesResponse.Hosts because the payload is too large to be included in the outgoing event
1423+
setPropertiesResponse.Hosts = nil
1424+
14091425
if odcErr := setPropertiesResponse.GetError(); odcErr != nil {
14101426
log.WithField("partition", envId).
14111427
WithError(err).
@@ -1537,8 +1553,9 @@ func handleConfigure(ctx context.Context, odcClient *RpcClient, arguments map[st
15371553
return err
15381554
}
15391555

1540-
// We nullify configureResponse.Devices because the payload is too large to be included in the outgoing event
1556+
// We nullify configureResponse.Devices and configureResponse.Reply.Hosts because the payload is too large to be included in the outgoing event
15411557
configureResponse.Devices = nil
1558+
configureResponse.Reply.Hosts = nil
15421559

15431560
if odcErr := configureResponse.Reply.GetError(); odcErr != nil {
15441561
err = fmt.Errorf("code %d from ODC: %s", odcErr.GetCode(), odcErr.GetMsg())

0 commit comments

Comments
 (0)