diff options
author | Florian Klink <flokli@flokli.de> | 2023-09-17T19·25+0300 |
---|---|---|
committer | flokli <flokli@flokli.de> | 2023-09-18T14·02+0000 |
commit | 749ab6721634c18ba9867d77e9e6d0e9860b6990 (patch) | |
tree | e4b8348b839bdf34cdc1707f221dd44625070f9f /tvix/nar-bridge/pkg | |
parent | 0c031461c3732fd925668a22a042aa5f1b2764f3 (diff) |
feat(tvix/nar-bridge): buffer request body a bit more r/6611
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 <cbrewster@hey.com>
Diffstat (limited to 'tvix/nar-bridge/pkg')
-rw-r--r-- | tvix/nar-bridge/pkg/server/nar_put.go | 3 |
1 files changed, 2 insertions, 1 deletions
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), |