From 2cf530c326c594f8b999e53031a35a8cded61e40 Mon Sep 17 00:00:00 2001 From: Copybara Service Date: Thu, 16 Jul 2026 03:11:56 -0700 Subject: [PATCH] Allow implementations of server services to free message payloads on successful processing PiperOrigin-RevId: 948864310 --- fleetspeak/src/server/service/service.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fleetspeak/src/server/service/service.go b/fleetspeak/src/server/service/service.go index a7d3d4a1..7eeaa511 100644 --- a/fleetspeak/src/server/service/service.go +++ b/fleetspeak/src/server/service/service.go @@ -42,7 +42,10 @@ type Service interface { // net.Error which reports as a timeout or temporary error, the message will // be retried according the ServerRetryPolicy. Otherwise the error will be // assumed to be permanent. - ProcessMessage(context.Context, *fspb.Message) error + // The implementation is allowed to set `m.Data = nil` to optimize memory + // usage if the operation is successful. On failure, it must make sure that + // `m.Data` is still intact when returning. + ProcessMessage(ctx context.Context, m *fspb.Message) error // Stop initiates and waits for an orderly shut down. It will only be // called when there are no more active calls to ProcessMessage and