From 749ab6721634c18ba9867d77e9e6d0e9860b6990 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 17 Sep 2023 22:25:30 +0300 Subject: feat(tvix/nar-bridge): buffer request body a bit more Let's make sure we don't end up blocking a client too much when inserting very small blobs. Change-Id: I640dda92efae538c70d32a40e6e85a23e9749e20 Reviewed-on: https://cl.tvl.fyi/c/depot/+/9358 Tested-by: BuildkiteCI Reviewed-by: Connor Brewster --- tvix/nar-bridge/pkg/server/nar_put.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'tvix') diff --git a/tvix/nar-bridge/pkg/server/nar_put.go b/tvix/nar-bridge/pkg/server/nar_put.go index 9d6752e85bf1..6d8b2bbd41ca 100644 --- a/tvix/nar-bridge/pkg/server/nar_put.go +++ b/tvix/nar-bridge/pkg/server/nar_put.go @@ -39,7 +39,8 @@ func registerNarPut(s *Server) { directoriesUploader := NewDirectoriesUploader(ctx, s.directoryServiceClient) defer directoriesUploader.Done() //nolint:errcheck - rd := reader.New(bufio.NewReader(r.Body)) + // buffer the body by 10MiB + rd := reader.New(bufio.NewReaderSize(r.Body, 10*1024*1024)) pathInfo, err := rd.Import( ctx, genBlobServiceWriteCb(ctx, s.blobServiceClient), -- cgit 1.4.1