Improve object reuse for grid messages (#18940)

Allow internal types to support a `Recycler` interface, which will allow for sharing of common types across handlers.

This means that all `grid.MSS` (and similar) objects are shared across in a common pool instead of a per-handler pool.

Add internal request reuse of internal types. Add for safe (pointerless) types explicitly.

Only log params for internal types. Doing Sprint(obj) is just a bit too messy.
This commit is contained in:
Klaus Post
2024-02-01 12:41:20 -08:00
committed by GitHub
parent 6440d0fbf3
commit b192bc348c
8 changed files with 256 additions and 76 deletions
+1 -1
View File
@@ -981,7 +981,7 @@ func (s *peerRESTServer) ListenHandler(ctx context.Context, v *grid.URLValues, o
logger.LogOnceIf(ctx, err, "event: Encode failed")
continue
}
out <- grid.NewBytesWith(append(grid.GetByteBuffer()[:0], buf.Bytes()...))
out <- grid.NewBytesWithCopyOf(buf.Bytes())
}
}
}